Skip to content
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

Move site title href to route data for easier overrides #1842

Merged
merged 4 commits into from May 14, 2024

Conversation

delucis
Copy link
Member

@delucis delucis commented May 8, 2024

Description

  • Currently <SiteTitle> calculates the value of its link internally. This makes it tricky for people to set the link while reusing the default component implemenation.
  • This PR adds a siteTitleHref property to the route data object (and the one for StarlightPage), moving the logic for working out the link path there.
  • This means in an override you can set Astro.props.siteTitleHref = '/custom-link/' if you need and still use the default component implementation.

Considerations

  • This is still more complex than adding a dedicated Starlight option for the site title link. Should we consider that? There’s a bit of complexity due to how this intersects with i18n locales, so not 100% what a good config would look like.
  • I’ve named the new prop siteTitleHref for now, but it could also be something more generic like homeLink I guess?

Copy link

vercel bot commented May 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
starlight ✅ Ready (Inspect) Visit Preview May 14, 2024 10:20pm
1 Ignored Deployment
Name Status Preview Updated (UTC)
starlight-i18n ⬜️ Ignored (Inspect) May 14, 2024 10:20pm

Copy link

changeset-bot bot commented May 8, 2024

🦋 Changeset detected

Latest commit: 73ad8e5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label May 8, 2024
@astrobot-houston
Copy link
Collaborator

astrobot-houston commented May 8, 2024

size-limit report 📦

Path Size
/index.html 6.1 KB (0%)
/_astro/*.js 22.02 KB (0%)
/_astro/*.css 13.45 KB (0%)

@github-actions github-actions bot added the 📚 docs Documentation website changes label May 8, 2024
@astrobot-houston
Copy link
Collaborator

astrobot-houston commented May 8, 2024

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en reference/overrides.md Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@wpplumber
Copy link

Welcome,

Does this got a confirmation and will be published soon?

Copy link
Member

@HiDeoo HiDeoo left a comment

Choose a reason for hiding this comment

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

Just tried it out and it works perfectly 🙌

docs/src/content/docs/reference/overrides.md Outdated Show resolved Hide resolved
Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com>
@delucis delucis merged commit c783863 into main May 14, 2024
11 of 12 checks passed
@delucis delucis deleted the chris/site-title-href branch May 14, 2024 22:19
@astrobot-houston astrobot-houston mentioned this pull request May 14, 2024
HiDeoo added a commit to HiDeoo/starlight that referenced this pull request May 15, 2024
* main:
  i18n(zh-cn): Update `overrides.md` (withastro#1864)
  [ci] format
  [ci] release (withastro#1839)
  Add comment and heart icons (withastro#1837)
  [ci] format
  Add HackerOne Icon (withastro#1840)
  Update Vietnamese translation (withastro#1863)
  Move site title `href` to route data for easier overrides (withastro#1842)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌟 core Changes to Starlight’s main package 📚 docs Documentation website changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants