Skip to content

Commit 65026c0

Browse files
authored
feat(blog): external canonical for syndicated posts (nodejs#7879)
* feat(blog): external canonical for syndicated posts * docs(frontmatter): external canonical for syndicated posts * docs(frontmatter): clarify syndicated context Signed-off-by: Matt Cowley <[email protected]> --------- Signed-off-by: Matt Cowley <[email protected]>
1 parent 2fc6472 commit 65026c0

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

apps/site/next.dynamic.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ const getDynamicRouter = async () => {
230230
];
231231

232232
// Default canonical URL for the page
233-
pageMetadata.alternates.canonical = getUrlForPathname(locale, path);
233+
pageMetadata.alternates.canonical =
234+
data.canonical ?? getUrlForPathname(locale, path);
234235

235236
// Default alternate URL for the page in the default locale
236237
pageMetadata.alternates.languages['x-default'] = getUrlForPathname(

apps/site/pages/en/blog/announcements/mikeal.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ category: announcements
44
title: 'In Memory of Mikeal Rogers: A Builder of Communities'
55
layout: blog-post
66
author: Robin Bender Ginn
7+
canonical: https://openjsf.org/blog/in-memory-of-mikeal-rogers
78
---
89

910
![][mikeal-rogers-image]

docs/adding-pages.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ The frontmatter (YAML block at the top) configures page metadata:
6363
- `description`: Optional meta description for SEO
6464
- `authors`: For learn pages, list of GitHub usernames
6565

66+
In cases where content has been syndicated from another source, you should also include:
67+
68+
- `canonical`: The original URL of the content
69+
6670
### 3. Choose the Appropriate Layout
6771

6872
Available layouts are defined in `apps/site/layouts/`, and mapped in `components/withLayout`.

0 commit comments

Comments
 (0)