withastro / starlight

🌟 Build beautiful, accessible, high-performance documentation websites with Astro
https://starlight.astro.build
MIT License
4.83k stars 522 forks source link

Deploy to GitHub Pages #804

Closed torn4dom4n closed 1 year ago

torn4dom4n commented 1 year ago

What version of starlight are you using?

0.10.4

What is your idea?

Enable to deploy a site using Starlight to GitHub Pages using GitHub Actions

Why is this feature necessary?

Astro supports deployment to GitHub Pages so I think this is a great idea.

Do you have examples of this feature in other projects?

https://github.com/MedPocket/18-months

Participation

delucis commented 1 year ago

This is possible already! Following the GitHub pages deploy guide in Astro’s docs should work for Starlight sites too. If it doesn’t, that’s a bug.

torn4dom4n commented 1 year ago

@delucis I try to config like docs but it doesn't work. Although I can get https://medpocket.github.io/18-months/ but when I click into Khám phá button it navigation to https://medpocket.github.io/nhat-ky/231003 instead https://medpocket.github.io/18-months/nhat-ky/231003 You can see full option in my repos.

torn4dom4n commented 1 year ago

I read the docs and update index.mdx so this issue should be close.

delucis commented 1 year ago

Ah yeah, you do still need to write links to include the base path, so in your hero config:

hero:
  tagline: Hành trình 18 tháng của Louis Nguyen.
  image:
    file: ../../assets/logo.svg
  actions:
    - text: Khám phá
      link: /18-months/nhat-ky/231003/

By the way, I see you have translated the UI into Vietnamese in that repo: https://github.com/MedPocket/18-months/blob/c75d4082f43ca8cd7b8478bf52f56e83504f23ef/src/content/i18n/vi/vi.json

If you feel like submitting a PR adding that to Starlight for everyone to use, that would be much appreciated! We have guidance on how to do that here: https://github.com/withastro/starlight/blob/main/CONTRIBUTING.md#translations

You could also submit the Pagefind search translations to the Pagefind repo: https://github.com/CloudCannon/pagefind/tree/main/pagefind_ui/translations

torn4dom4n commented 1 year ago

@delucis Thank you again for looking inside my repo. I'll do a PR for Vietname translation.

torn4dom4n commented 1 year ago

Ah yeah, you do still need to write links to include the base path, so in your hero config:

hero:
  tagline: Hành trình 18 tháng của Louis Nguyen.
  image:
    file: ../../assets/logo.svg
  actions:
    - text: Khám phá
      link: /18-months/nhat-ky/231003/

I thought the same as you but if I do this, it only works on GitHub CI and gets 404 error on development. I searched and found this issue the same as #347. I hope PR #406 can fix this.

delucis commented 1 year ago

I thought the same as you but if I do this, it only works on GitHub CI and gets 404 error on development. I searched and found this issue the same as #347. I hope PR #406 can fix this.

Ah I think that’s because you only set base/ when building in GitHub: https://github.com/MedPocket/18-months/blob/c75d4082f43ca8cd7b8478bf52f56e83504f23ef/astro.config.mjs#L9

If you always set that to /18-months, it should work locally too.

I'll do a PR for Vietname translation.

Just saw your PR — thank you!