-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Meta tags are currently receiving default values from Notion, e.g.:
<meta name="twitter:site" content="@NotionHQ">
<meta name="twitter:title" content="Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.">
<meta name="twitter:description"
content="A new tool that blends your everyday work apps into one. It's the all-in-one workspace for you and your team">
<!--- ... -->
<meta property="og:title" content="Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.">
<meta property="og:description"
content="A new tool that blends your everyday work apps into one. It's the all-in-one workspace for you and your team">Which leads to SEO issues:
The problem is likely happening at:
notehost/src/rewriters/meta-rewriter.ts
Lines 23 to 24 in d227b8c
| content = content.replace(' | Built with Notion', '') | |
| content = content.replace(' | Notion', '') |
Which gets used at:
notehost/src/rewriters/meta-rewriter.ts
Lines 29 to 35 in d227b8c
| if (element.tagName === 'title') { | |
| element.setInnerContent(content) | |
| } | |
| if (property === 'og:title' || name === 'twitter:title') { | |
| element.setAttribute('content', content) | |
| } |
And:
notehost/src/rewriters/meta-rewriter.ts
Lines 41 to 50 in d227b8c
| if (name === 'description' || property === 'og:description' || name === 'twitter:description') { | |
| if (this.isRootPage) { | |
| element.setAttribute('content', siteDescription) | |
| } else { | |
| element.setAttribute( | |
| 'content', | |
| content.replace('Built with Notion, the all-in-one connected workspace with publishing capabilities.', ''), | |
| ) | |
| } | |
| } |
A quick and dirty workaround is to use siteName and siteDescription instead of content for all pages. A more flexible solution would be to parameterise slugs with optional custom titles + descriptions, falling back to siteNameand description:
siteName: 'My Notion Website',
siteDescription: 'Build your own website with Notion. This is a demo site.',
// Should replace twitter:site
siteTwitter: '@MyHandle'
slugToPage: {
'': 'NOTION_PAGE_ID',
about: 'NOTION_PAGE_ID',
// Both pages above will fallback to siteName + description
contact: {
id: 'NOTION_PAGE_ID',
title: 'Contact form',
description: 'Bla bla bla',
},
},Bonus, we should probably prepend https:// to the domain at:
notehost/src/rewriters/meta-rewriter.ts
Lines 52 to 54 in d227b8c
| if (property === 'og:url' || name === 'twitter:url') { | |
| element.setAttribute('content', domain) | |
| } |
