Skip to content

Conversation

To1ne
Copy link
Collaborator

@To1ne To1ne commented Aug 15, 2025

Changes

An attempt to make it look more pretty.

Context

Recently the TOC was added, in the sidebar. This PR attempts to make it integrate better into the aesthetic.

20250815_13h57m44s_grim

Deployed to https://to1ne.github.io/git-scm.com/docs/git-rebase

TODO

  • Bring back the sticky sidebars
  • Better on mobile
  • Maybe put above the rest of the page nav?
  • Check/fix book pages

To1ne added 4 commits August 15, 2025 14:01
Only put the navigation across other pages in the <nav> element.
Use semantic HTML to make the table of contents in the sidebar
collapsible.
Make sidebar.scss the single-source-of-truth and put all the styling
related to the sidebar in sidebar.scss.
Give the sidebar the same background as the main content and make the
border wrap around the table of contents.
@To1ne
Copy link
Collaborator Author

To1ne commented Aug 15, 2025

@jvns @dscho This is a first try at integrating the TOC better. I'm not yet fully in love with it, but wanted to share my first idea already.

Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

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

I wonder whether it is even possible to keep the table of contents sticky without it being in the <nav> section...

Comment on lines -66 to +87
{{ if (eq .Params.Sidebar "book") }}
<hr class="sidebar">
{{- /* If this page displays a section of the ProGit book, map all the translations thereof */ -}}
{{ with $.Page.Params.book }}
{{ $cs_number := .section.cs_number }}
{{ range $.Page.Site.Data.book }}
{{ $language_code := .language_code }}
{{ range .chapters }}
{{ range .sections }}
{{ if (eq .cs_number $cs_number) }}
{{ $.Scratch.SetInMap "translations" $language_code .url }}
{{ end }}
{{ if (eq .Params.Sidebar "book") }}
<hr class="sidebar">
{{- /* If this page displays a section of the ProGit book, map all the translations thereof */ -}}
{{ with $.Page.Params.book }}
{{ $cs_number := .section.cs_number }}
{{ range $.Page.Site.Data.book }}
{{ $language_code := .language_code }}
{{ range .chapters }}
{{ range .sections }}
{{ if (eq .cs_number $cs_number) }}
{{ $.Scratch.SetInMap "translations" $language_code .url }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ partial "translations.html" . }}
{{ else if (and (ne $section "documentation") (ne $section "site")) }}
<hr class="sidebar">
{{ partial "book.html" }}
{{ end }}
</nav>
{{ partial "translations.html" . }}
{{ else if (and (ne $section "documentation") (ne $section "site")) }}
<hr class="sidebar">
{{ partial "book.html" }}
{{ end }}
Copy link
Member

Choose a reason for hiding this comment

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

I think that the translated books may want to stay in the <nav> bar?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that the translated books may want to stay in the

bar?

@dscho Maybe, yes. I didn't check the book yet. I should have. Putting it on my list.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dscho Why are book translations in the sidebar and man page translations at the top? I think they all should go in the top nav.

@To1ne
Copy link
Collaborator Author

To1ne commented Aug 16, 2025

I wonder whether it is even possible to keep the table of contents sticky without it being in the

section...

@dscho Yeah, that's something I wanted to figure out still.

@To1ne
Copy link
Collaborator Author

To1ne commented Aug 16, 2025

@dscho This is still work-in-progress to see if we like the design. Once we settle on the look, I will figure out how to make it all work.

@To1ne
Copy link
Collaborator Author

To1ne commented Aug 17, 2025

@dscho This is still work-in-progress to see if we like the design. Once we settle on the look, I will figure out how to make it all work.

For example, would "on this page" on the top work better?

image

@dscho
Copy link
Member

dscho commented Aug 17, 2025

I like that! @jvns what is your opinion?

@jvns
Copy link
Contributor

jvns commented Aug 17, 2025

I like the way it connects to the page's content! It feels a little weird to push the main navigation down like that -- in a way it seems like the "table of contents" should actually be a sub-item of "Reference" somehow (like we're at Documentation -> Reference -> git-add. But I don't see a way to put it there.

@To1ne
Copy link
Collaborator Author

To1ne commented Aug 17, 2025

@jvns I kind a like that idea. I've been wanted to have more like a breadcrumbs style navigation and that's what you're suggesting with Documentation -> Reference -> git-add. Now putting that in the sidebar, and then the headings of that page in that tree will nest them very deep and indentation will make it impossible to have headings that are longer than a few chars. So far from ideal.

Personally I think the whole navigation on this website is awkward. Maybe a bigger overhaul is needed. If we can find someone to put the work into that (not sure that one will be me, but I'll think about it). cc @dscho

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.

3 participants