Skip to content

Add support for og meta tags and better SEO discovery.#47

Open
Riwaz wants to merge 1 commit into
WrenSecurity:mainfrom
Riwaz:seo-og-tags-support
Open

Add support for og meta tags and better SEO discovery.#47
Riwaz wants to merge 1 commit into
WrenSecurity:mainfrom
Riwaz:seo-og-tags-support

Conversation

@Riwaz

@Riwaz Riwaz commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

This PR lays the groundwork for social sharing previews and search-engine discoverability.

  • Add og:* and twitter:* meta tags. Most are static (og:type, og:site_name, twitter:card, twitter:site) or computed from the page's URL (og:url, canonical link). og:title/og:description reuse each page's existing title/description frontmatter. No new fields were added and the values are falling back to the site-wide description when unset. og:image is the one tag with a dedicated override: an optional image frontmatter field, falling back to a placeholder logo. Only the home page's title/description have been updated so far; other pages still use generic existing tittles, description fallbacks.
  • Add a <link rel="canonical"> per page, reusing the same URL logic as og:url.
  • Enable VitePress's built-in sitemap.xml generation.
  • Add robots.txt pointing to the new sitemap.
  • Add an RSS <link rel="alternate"> discovery tag for the existing feed.rss, so feed readers can auto-detect it.

Comment thread site/.vitepress/config.ts Outdated
['meta', { property: 'og:site_name', content: siteData.title }],
['meta', { property: 'og:title', content: pageData.title }],
['meta', { property: 'og:description', content: description }],
['meta', { property: 'og:image', content: `https://wrensecurity.org${image}` }],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hostname shoud be i a (config) variable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added const variables (even for already existing links). The values are taken from env variables, if it's not specified in ENV variable a default value is used.

There was missing type for node in typescript so I was getting an IDE error for the process variable. This was already a problem in the repository in other part. So I added the node type to typescript.

Comment thread site/.vitepress/config.ts Outdated
],
transformHead({ description, pageData, siteData }) {
const image = pageData.frontmatter.image || '/wrensec-logo.png';
const htmlPath = pageData.relativePath.replace(/\.md$/, '.html');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TransformContext parameter of the transformHead have a page parameter that should respect the rewrites.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The page is the same as the pageData.relativePath as we don't configure rewrites for this repository. And even if we did, it returns the path with .md at the end and doesn't do the convert to the actual deployed url. So we need to keep the transformation.

Comment thread site/.vitepress/config.ts Outdated
['meta', { property: 'og:description', content: description }],
['meta', { property: 'og:image', content: `https://wrensecurity.org${image}` }],
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
['meta', { name: 'twitter:site', content: '@WrenSecurity' }],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The twitter account belongs to a config as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as configurable const via env variables.

@Riwaz
Riwaz force-pushed the seo-og-tags-support branch from 2e7a86c to 3527186 Compare July 21, 2026 14:01
@Riwaz
Riwaz force-pushed the seo-og-tags-support branch from 3527186 to 34c1dad Compare July 21, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants