Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding social media meta tags :) #1090

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/node/build/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function renderPage(
? [appChunk.fileName]
: []
: result && appChunk
? [
? [
...new Set([
// resolve imports for index.js + page.md.js and inject script tags
// for them as well so we fetch everything as early as possible
Expand All @@ -93,7 +93,7 @@ export async function renderPage(
appChunk.fileName
])
]
: []
: []

let prefetchLinks: string[] = []

Expand All @@ -105,17 +105,15 @@ export async function renderPage(

const preloadLinksString = preloadLinks
.map((file) => {
return `<link rel="modulepreload" href="${
EXTERNAL_URL_RE.test(file) ? '' : siteData.base // don't add base to external urls
}${file}">`
return `<link rel="modulepreload" href="${EXTERNAL_URL_RE.test(file) ? '' : siteData.base // don't add base to external urls
}${file}">`
})
.join('\n ')

const prefetchLinkString = prefetchLinks
.map((file) => {
return `<link rel="prefetch" href="${
EXTERNAL_URL_RE.test(file) ? '' : siteData.base // don't add base to external urls
}${file}">`
return `<link rel="prefetch" href="${EXTERNAL_URL_RE.test(file) ? '' : siteData.base // don't add base to external urls
}${file}">`
})
.join('\n ')

Expand Down Expand Up @@ -152,26 +150,28 @@ export async function renderPage(
<!DOCTYPE html>
<html lang="${siteData.lang}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>${title}</title>
<meta name="description" content="${description}">
<meta name="description" content="${description}" />
<meta name="og:title" content="${title}" />
<meta name="og:description" content="${description}" />
<meta name="twitter:title" content="${title}" />
<meta name="twitter:description" content="${description}" />
${stylesheetLink}
${preloadLinksString}
${prefetchLinkString}
${await renderHead(head)}
</head>
<body>
<div id="app">${content}</div>
${
config.mpa
? ''
: `<script>__VP_HASH_MAP__ = JSON.parse(${hashMapString})</script>`
${config.mpa
? ''
: `<script>__VP_HASH_MAP__ = JSON.parse(${hashMapString})</script>`
}
${
appChunk
? `<script type="module" async src="${siteData.base}${appChunk.fileName}"></script>`
: ``
${appChunk
? `<script type="module" async src="${siteData.base}${appChunk.fileName}"></script>`
: ``
}
${inlinedScript}
</body>
Expand Down