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

Integration of a Persistent Navigation Link between Blog and Documentation Sections #50

Open
bjorne84 opened this issue Jun 14, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@bjorne84
Copy link

Is your feature request related to a problem?

Yes, it's related to navigation issues within the site.

Describe the solution you'd like

I would like a feature where a persistent navigation link or button is available that connects the blog section directly back to the documentation/wiki part of the site. This could be a simple "Back to Documentation" button or a more integrated navigational element in the site's header or sidebar.

Describe alternatives you've considered

No response

Additional Context

No response

@HiDeoo
Copy link
Owner

HiDeoo commented Jun 17, 2024

Thanks for the feedback, super appreciated 🙌

This is definitely an area that I want to improve in the plugin but I have not yet figured out what would be the best way to do it:

  • Should it be something simple like adding a Docs link next to the Blog existing one in the right part of the header? Something in the sidebar or at the top of the content section?
  • Should the existing link to the blog just update based on the current route?
  • What level of configuration would be useful? Some people do not use Starlight as documentation per se so the label of such link would need to be configurable. I can see some people wanting such links to be at the left of the header after the logo instead of the right.
  • I would guess some people would want to prefer the existing behavior.

I am open to suggestions and feedback on this topic but until then, this is something that could be achieved using a Starlight override for the ThemeSelect component.

This is the component overriden by the blog plugin to add the link to the blog at the right of the header and by providing your own override, you would be able to have control over the link or add one for the documentation.

Just like the blog plugin override, you own override will need to reuse the built-in ThemeSelect component after adding your own custom links which would change based on the current route.

An example of the override could look like this:

---
import Default from '@astrojs/starlight/components/ThemeSelect.astro'
import type { Props } from '@astrojs/starlight/props'

const isBlog = Astro.props.slug.startsWith('blog')
---

<div>
  <a href="/">Docs</a>
  <a href="/blog/">Blog</a>
</div>
<Default {...Astro.props}><slot /></Default>

<style>
  div {
    border-inline-end: 1px solid var(--sl-color-gray-5);
    display: none;
    gap: var(--sl-nav-gap);
    padding-inline-end: 1rem;
  }

  @media (min-width: 50rem) {
    div {
      display: flex;
    }
  }

  a {
    color: var(--sl-color-text-accent);
    font-weight: 600;
    text-decoration: none;
  }
</style>

@HiDeoo HiDeoo added the enhancement New feature or request label Jun 17, 2024
@bjorne84
Copy link
Author

Great,
I think your example override works fine for desktop and for mobile just a simple link link in the Sidebar, just as the existing override adds a link to the blog if its not a blog
!isBlog && (


<a href={getBlogPathWithBase('/')}>{config.title}

)

About the configuration, well a true/false to show the link or not and label text,

@sanabel-al-firdaws
Copy link

check out tauri docs it looks so good it compines different starlight plugins together to get this look

Screenshot_20240704_214527_com kiwibrowser browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants