Skip to content

Commit

Permalink
feat: added ability to add canonical url to frontmatter (#1588)
Browse files Browse the repository at this point in the history
  • Loading branch information
RohinBhargava authored Oct 2, 2024
1 parent 19fd1d7 commit dd01309
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fern/apis/fdr/definition/docs/latest/frontmatter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ types:
availability: deprecated
type: optional<string>
docs: Use subtitle instead.
canonical-url:
type: optional<string>
docs: The canonical URL of the page. This is used for the <link rel="canonical"> tag in the HTML.

Layout:
enum:
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/ui/app/src/seo/getSeoProp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ export function getSeoProps(
const page = pages[pageId];
if (page != null) {
const { data: frontmatter, content } = getFrontmatter(page.markdown);

if (frontmatter["canonical-url"] != null) {
seo.canonical = frontmatter["canonical-url"];
}

ogMetadata = { ...ogMetadata, ...frontmatter };

// retrofit og:image, preferring og:image
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dd01309

Please sign in to comment.