Skip to content

Respect baseurl for fork repos; Simplify page header - #9

Open
zjp-CN wants to merge 5 commits into
asterinas:mainfrom
os-checker:baseurl
Open

Respect baseurl for fork repos; Simplify page header#9
zjp-CN wants to merge 5 commits into
asterinas:mainfrom
os-checker:baseurl

Conversation

@zjp-CN

@zjp-CN zjp-CN commented Aug 12, 2026

Copy link
Copy Markdown

Contributors usually fork asterinas.github.io repo to their own as contributor/asterinas.github.io.

When they deploy a branch of fork to Github Pages, all local paths start from https://contributor.github.io rather than https://contributor.github.io/asterinas.github.io.

If a PR reviewer needs to check the website interactively, the contributor has to handle the link problem, as the deployed webpage is fully broken like this.

image

With this PR, a contributor only needs to set baseurl: "/asterinas.github.io" in _config.yml to make these project links and assets valid.

image

This PR also simplifies header for different pages by

  • making each tab item be a plain link to remove click event listener
  • sharing the html/css/js header template to reuse in different webpages

@zjp-CN

zjp-CN commented Aug 12, 2026

Copy link
Copy Markdown
Author

With the idea of #10 , you can preview the latest development link1 by clicking the "View deployment" button in os-checker#1

image
F12 on tab item: this PR deployment

image

F12 on tab item: current asterinas

image

Footnotes

  1. the link changes as new commit is pushed, so I won't leave the unique link here

@zjp-CN zjp-CN changed the title Apply baseurl to fix deployment links for fork repos Respect baseurl for fork repos; Simplify page header Aug 12, 2026
<a class="tab" href="https://asterinas.github.io/book">Docs</a>
</div>
</div>
{% include site-nav.html active="blog" %}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Asterinas homepage doesn't have a contributors tab, but the url path https://asterinas.github.io/contributors.html is accessible with Blog tag highlighted.

Image

So active="blog" just follows the behavior.

Comment thread _layouts/post.html
<a class="tab" href="https://asterinas.github.io/book">Docs</a>
</div>
</div>
{% include site-nav.html active="blog" %}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

https://asterinas.github.io/post.html is 404. Maybe we should just remove this page?

Image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for pointing this out. But this is a separate problem. Could you fix it in another PR?

@tatetian

tatetian commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

With this PR, a contributor only needs to set baseurl: "/asterinas.github.io" in _config.yml to make these project links and assets valid.

This looks a fragile solution to me. When one forks a project, she can choose to name the forked repo differently than the parent repo. Could you think of a more robust solution?

# For forks (e.g., `username/asterinas.github.io` hosted on GitHub Pages),
# set `baseurl` to `/asterinas.github.io` to ensure all local links and assets resolve correctly.
baseurl: "" # "/asterinas.github.io"

And the developer of a forked website still needs to change the URL manually. This is another problem.

So overall, the solution is not ideal. Think harder?

@zjp-CN

zjp-CN commented Aug 15, 2026

Copy link
Copy Markdown
Author

An ideal sulution is #10 , contributors just submit a PR, vercel bot builds and notifies a unique preview link when a commit is pushed.

You have to login vercel and set up this repo in vercel. The vercel service is free. Just some clicks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants