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

Sidebar/TOC: width and chronological ordering? #885

Open
dietervansteenwegen opened this issue Feb 6, 2024 · 3 comments
Open

Sidebar/TOC: width and chronological ordering? #885

dietervansteenwegen opened this issue Feb 6, 2024 · 3 comments

Comments

@dietervansteenwegen
Copy link
Contributor

I have the sidebar/TOC for the posts set up as I want it (with categories), but I'd like to change two more things:

  • by default, the sidebar is rather small. Is there a way to make it wider/define the width without having to make changes to the theme? If not, where would I make that change in the theme?
  • Is there an option to sort the post chronologically (by post date) in the sidebar? I can order them manually by playing with the menu: sidebar: weight: 10 value and setting it incrementing by date, but maybe there is setting somewhere?
@BernatBC
Copy link
Contributor

BernatBC commented Feb 6, 2024

Hi @dietervansteenwegen
As far as I know, I don't think there's any of the two options. However,

  • I think you can modify the width of the sidebar in the file assets/styles/navigators/sidebar.scss.
  • For the second option, I guess we would need to change either layouts/partials/navigators/sidebar.html or assets/scripts/sections/sidebar.js.

@dietervansteenwegen
Copy link
Contributor Author

@BernatBC allright, thanks.

Chronological sorting seemed something so basic and obvious, I kind of expected it to be part of Hugo itself.

Actually... Just realized I didn't check if it isn't possible by default in Hugo :(. Checked the Toha docs and source, but forgot Hugo base functionality. Will check tomorrow.

@hossainemruz
Copy link
Member

The sidebar items are manually sorted so that you can organize posts into category and sub-category. However, the post cards are chronologically sorted. If you need sidebar to be more like other blog where it will be categorized by month/year, you will have to create a new sidebar layout. Hugo provides the basic functionalities to group/sort posts by date.
Ref: https://gohugo.io/variables/pages/

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

No branches or pull requests

3 participants