Skip to content

Commit

Permalink
fixup! fix(spas): set canonical url
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Apr 29, 2024
1 parent 7252421 commit fc1ac04
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build/spas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,11 @@ async function fetchLatestNews() {

function renderPage(url: string, context: any) {
const html = renderHTML(url, context);
// Better safe than sorry.
html.replace(
`<link rel="canonical" href="https://developer.mozilla.org"/>`,
`<link rel="canonical" href="https://developer.mozilla.org${url}"/>`
);
html.replace(
`<link rel="canonical" href="${BASE_URL}"/>`,
`<link rel="canonical" href="${BASE_URL}${url}"/>`
Expand Down

0 comments on commit fc1ac04

Please sign in to comment.