mirror of
https://github.com/osmarks/website
synced 2025-03-09 21:18:11 +00:00
fix og:url
This commit is contained in:
parent
f8c2de3365
commit
cc29431570
11
src/index.js
11
src/index.js
@ -240,8 +240,10 @@ const applyTemplate = async (template, input, getOutput, options = {}) => {
|
||||
const page = parseFrontMatter(await readFile(input))
|
||||
if (options.processMeta) { options.processMeta(page.data, page) }
|
||||
if (options.processContent) { page.originalContent = page.content; page.content = options.processContent(page.content) }
|
||||
const rendered = template({ ...globalData, ...page.data, content: page.content })
|
||||
await fsp.writeFile(await getOutput(page), minifyHTML(rendered))
|
||||
const output = await getOutput(page)
|
||||
const urlPath = "/" + path.relative(outDir, output).replace(/index\.html$/, "")
|
||||
const rendered = template({ ...globalData, ...page.data, content: page.content, path: output.replace(/index\.html$/, "") })
|
||||
await fsp.writeFile(output, minifyHTML(rendered))
|
||||
page.data.full = page
|
||||
return page.data
|
||||
}
|
||||
@ -333,7 +335,8 @@ const processBlog = async () => {
|
||||
await fse.ensureDir(out)
|
||||
await fsp.writeFile(path.join(out, "index.html"), globalData.templates.blogPost({
|
||||
...globalData,
|
||||
...page
|
||||
...page,
|
||||
path: `/${page.slug}/` // TODO: inelegant
|
||||
}))
|
||||
}
|
||||
|
||||
@ -365,7 +368,7 @@ globalData.metricPrefix = applyMetricPrefix
|
||||
const writeBuildID = () => fsp.writeFile(path.join(outDir, "buildID.txt"), buildID)
|
||||
|
||||
const index = async () => {
|
||||
const index = globalData.templates.index({ ...globalData, title: "Index", posts: globalData.blog, description: globalData.siteDescription })
|
||||
const index = globalData.templates.index({ ...globalData, title: "Index", posts: globalData.blog, description: globalData.siteDescription, path: "/" })
|
||||
await fsp.writeFile(path.join(outDir, "index.html"), index)
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ html(lang="en")
|
||||
meta(property="og:description", content=description)
|
||||
meta(property="og:title", content=title)
|
||||
meta(property="og:type", content="website")
|
||||
meta(property="og:url", content=`https://${domain}`)
|
||||
meta(property="og:url", content=`https://${domain}${path}`)
|
||||
meta(property="og:site_name", content=name)
|
||||
link(rel="manifest", href="/assets/manifest.webmanifest")
|
||||
link(rel="shortcut icon", href="/assets/images/logo256.png", type="image/png")
|
||||
|
Loading…
x
Reference in New Issue
Block a user