-
Notifications
You must be signed in to change notification settings - Fork 0
Feature implementation from commits f33a2eb..2fd8041 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature-base-1
Are you sure you want to change the base?
Conversation
Co-authored-by: Chris Swithinbank <[email protected]>
Co-authored-by: Chris Swithinbank <[email protected]>
…thastro#2924) Co-authored-by: Chris Swithinbank <[email protected]>
…stro#2727) Co-authored-by: Chris Swithinbank <[email protected]> Co-authored-by: trueberryless <[email protected]> Co-authored-by: SnowDingo <[email protected]>
Co-authored-by: Chris Swithinbank <[email protected]>
Co-authored-by: HiDeoo <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Chris Swithinbank <[email protected]>
Co-authored-by: sarah11918 <[email protected]>
Co-authored-by: HiDeoo <[email protected]>
| }, | ||
| { tag: 'title', content: `${data.title} ${config.titleDelimiter} ${siteTitle}` }, | ||
| { tag: 'link', attrs: { rel: 'canonical', href: canonicalHref } }, | ||
| { tag: 'meta', attrs: { name: 'generator', content: context.generator } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Duplicate meta generator tags.
Two meta tags with name='generator' are defined with different content values, which violates HTML standards and causes unpredictable behavior across browsers.
Current Code (Diff):
- { tag: 'meta', attrs: { name: 'generator', content: context.generator } },
- {
- tag: 'meta',
- attrs: { name: 'generator', content: `Starlight v${version}` },
- },
+ { tag: 'meta', attrs: { name: 'generator', content: `${context.generator} (Starlight v${version})` } },📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
| { tag: 'meta', attrs: { name: 'generator', content: context.generator } }, | |
| // Use a single generator tag with combined information | |
| { tag: 'meta', attrs: { name: 'generator', content: `${context.generator} (Starlight v${version})` } }, |
| tag: 'meta', | ||
| attrs: { | ||
| name: 'twitter:site', | ||
| content: new URL(twitterLink.href).pathname.replace('/', '@'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Unsafe Twitter handle extraction.
The code assumes Twitter URLs always have a direct username path, but this fails with other URL formats like twitter.com/i/status/... or twitter.com/hashtag/...
Current Code (Diff):
- content: new URL(twitterLink.href).pathname.replace('/', '@'),
+ content: twitterLink.href.includes('twitter.com/') || twitterLink.href.includes('x.com/') ?
+ '@' + new URL(twitterLink.href).pathname.split('/').filter(Boolean)[0] :
+ new URL(twitterLink.href).hostname,📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
| content: new URL(twitterLink.href).pathname.replace('/', '@'), | |
| content: twitterLink.href.includes('twitter.com/') || twitterLink.href.includes('x.com/') ? | |
| '@' + new URL(twitterLink.href).pathname.split('/').filter(Boolean)[0] : | |
| new URL(twitterLink.href).hostname, |
PR Summary
Refactor Schema Validation and Add Head Tag Testing
Overview
This PR refactors schema validation components and adds comprehensive testing for head tag functionality. Key changes include converting the social links schema to an array-based approach, improving icon validation, and adding utilities for head tag testing.
Change Types
Affected Modules
starlight/schemas/social.tsstarlight/schemas/icon.tsstarlight/schemas/hero.tsstarlight/utils/head.tsstarlight/__tests__/head/head.test.tsstarlight/__tests__/test-utils.tsstarlight/__tests__/basics/starlight-page-route-data.test.tsNotes for Reviewers