Repository navigation
Give every page a unique title derived from its h1 - #63
Merged
Merged
Conversation
Each route with an h1 now exports metadata whose title is the same value the h1 shows; the root layout wraps it as "<h1> | Augmented Coding Patterns". The home page keeps the bare site name. Fixes #36 Amp-Thread-ID: https://ampcode.com/threads/T-01a18b16-89b6-7301-9d0c-e6ff7f681d32 Co-authored-by: Lada Kesseler <archie.kesseler@gmail.com>
The inline <title> rendered empty and duplicated the metadata title. Title tests now assert each page's title value and the layout template once instead of reimplementing Next's template. Amp-Thread-ID: https://ampcode.com/threads/T-01a18b16-89b6-7301-9d0c-e6ff7f681d32 Co-authored-by: Lada Kesseler <archie.kesseler@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #36.
Every page used to share the
<title>"Augmented Coding Patterns". Each page's title is now its h1 plus " | Augmented Coding Patterns". The home page keeps the site name on its own.How
title: { default: siteConfig.name, template: '%s | Augmented Coding Patterns' }.pattern.title(alternative-title redirect slugs resolve to the canonical pattern)labelPluralfromgetCategoryConfigcontributor.namePatternPageintoresolvePattern, sogenerateMetadataand the page share it. Behaviour is unchanged.Tests
tests/unit/components/pages.test.tsx, written first and seen failing: each page'stitlevalue, the layout template (checked once), and the redirect page having no inline<title>.<title>of/anti-patterns/answer-injection/equals its h1 plus the site suffix../test.sh(latest run on 892310e): 22 suites, 379 tests pass.npm run lint: 0 errors, 0 warnings../e2e.sh(latest run): 89 passed, 4 failed, 9 skipped. All 4 failures are iPhone/WebKit search tests from the pre-hydration bug fixed in Keep search text typed before the page finishes loading #64, which this branch doesn't include. Desktop and Android pass, including the new title smoke test. How many iPhone search tests fail varies between runs (4 to 6 so far).Redirect pages
Alternative-title redirect pages used to render an empty
<title></title>from inline JSX next to the metadata title. The inline title is gone, so they now have exactly one title, the canonical pattern's (e.g.Approved Scenarios | Augmented Coding Patterns). A unit test covers this.Title tests
The tests check each page's
titlevalue and check the layout template once, instead of reimplementing Next's template.