use comment instead of meta tag for _partial metadata
This commit is contained in:
parent
8e7c4b75ca
commit
04abd9f5b4
4
build.py
4
build.py
|
|
@ -67,7 +67,9 @@ def make_page(page, dest):
|
|||
out = base.replace('{{ content }}', post.content).replace('{{ title }}', post['title']) #+ f' - {"μ.twoha.cc" if minimal else "u.twoha.cc"}')
|
||||
path_write(dest, out)
|
||||
if not minimal:
|
||||
content = f'<meta name="metadata" content="{html.escape(json.dumps(post.metadata))}">\n{post.content}'
|
||||
dump = json.dumps(post.metadata)
|
||||
assert '-->' not in dump
|
||||
content = f'<!--{dump}-->\n{post.content}'
|
||||
path_write(outdir / '_partial' / dest.relative_to(outdir), content)
|
||||
|
||||
def main(_):
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ async function _loadContent(u, push=false) {
|
|||
const r = await fetch(url);
|
||||
if (r.ok) {
|
||||
let t = await r.text();
|
||||
let metadata = JSON.parse(t.substring(4, t.indexOf('-->\n')))
|
||||
content.innerHTML = t;
|
||||
if (push)
|
||||
history.pushState('', '', u);
|
||||
|
|
@ -31,7 +32,6 @@ async function _loadContent(u, push=false) {
|
|||
s.appendChild(document.createTextNode(e.innerHTML));
|
||||
e.parentNode.replaceChild(s, e);
|
||||
});
|
||||
let metadata = JSON.parse(document.querySelector('meta[name="metadata"]').content);
|
||||
document.title = metadata.title + ' - u.twoha.cc';
|
||||
currentPathname = p;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue