Skip to content

Improve page metadata for title and description (used in search results and social previews) - #69

Merged
LinqLover merged 2 commits into
masterfrom
page-metadata
Jul 12, 2026
Merged

Improve page metadata for title and description (used in search results and social previews)#69
LinqLover merged 2 commits into
masterfrom
page-metadata

Conversation

@LinqLover

Copy link
Copy Markdown
Contributor

Previously, these looked very generic for most pages (essentially showing the same text for almost all pages, and just repeating the title twice for release notes). Now they look much more precise. :-)

  • If no title is available from the page config, fall back to the title in the section config (global collection) (analogously to how <title> tag is already computed)
  • Descriptions can be be specified in the section config or in the frontmatter of pages
  • If no description is specified, generate one instead from the first meaningful paragraph of the page
  • Fix section generator to properly parse frontmatter from _head.md instead outputting it verbatim
image image image image

(https://socialsharepreview.com/)

LinqLover and others added 2 commits July 9, 2026 01:26
…ts and social previews)

Previously, these looked very generic for most pages (essentially showing the same text for almost all pages, and just repeating the title twice for release notes). Now they look much more precise. :-)

- If no title is available from the page config, fall back to the title in the section config (global collection) (analogously to how <title> tag is already computed)
- Descriptions can be be specified in the section config or in the frontmatter of pages
- If no description is specified, generate one instead from the first meaningful paragraph of the page
- Fix section generator to properly parse frontmatter from _head.md instead outputting it verbatim

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 23:31

Copilot AI left a comment

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.

Pull request overview

This PR improves the precision of page <title>, meta name="description", and Open Graph metadata so search results and social previews better reflect each page/section, including more helpful fallbacks when explicit metadata isn’t provided.

Changes:

  • Add and propagate section/page descriptions via _config.yml, page frontmatter, and _head.md frontmatter.
  • Update the section generator to parse _head.md frontmatter instead of rendering it as content, and to provide a section-title fallback for metadata.
  • Introduce a post-render hook that derives a description from the first meaningful paragraph when none is provided, and patches rendered meta tags accordingly.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
index.html Reuses the welcome text as the page description via YAML anchor/alias to improve homepage metadata.
_plugins/section_generator.rb Parses _head.md frontmatter, sets section-level description/title fallback flags for downstream metadata generation.
_plugins/page_metadata.rb Adds description extraction and post-render meta tag rewriting for more accurate description and Open Graph tags.
_pages/terse_guide.md Adds an explicit description in frontmatter for better previews.
_pages/board.md Adds an explicit description in frontmatter for better previews.
_downloads/_head.md Adds frontmatter description for the downloads section (now correctly parsed by the generator).
_config.yml Adds a description for the documentation collection to provide a section-level fallback.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread _plugins/page_metadata.rb
Comment on lines +46 to +52
def first_front_page_item_description(section)
item = section&.docs
&.select { |doc| doc.data['front-page'] }
&.min_by { |doc| doc.data['order'].to_i }

plain_text(item.content) if item
end
@LinqLover
LinqLover merged commit 1913ca7 into master Jul 12, 2026
3 checks passed
@LinqLover
LinqLover deleted the page-metadata branch July 12, 2026 13:23
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