Skip to content

fix: Automate tutorial sidebar generation#810

Open
Aayushman-nvm wants to merge 1 commit intoprecice:masterfrom
Aayushman-nvm:issue586
Open

fix: Automate tutorial sidebar generation#810
Aayushman-nvm wants to merge 1 commit intoprecice:masterfrom
Aayushman-nvm:issue586

Conversation

@Aayushman-nvm
Copy link

@Aayushman-nvm Aayushman-nvm commented Feb 25, 2026

Automate tutorial sidebar generation

Replaces the manually maintained tutorial_sidebar.yml with a Liquid-based auto-discovery system (partial fix for #586).

Problem

Adding a tutorial required manually updating tutorial_sidebar.yml, creating duplication and cross-repo dependency between the main site and the tutorials submodule.

Solution

  • _includes/sidebar.html
    Dispatches to a dedicated tutorial sidebar include when tutorial_sidebar is requested. Other sidebars remain unaffected.

  • _includes/tutorial_sidebar.html
    Auto-builds the sidebar using site.pages filtered to imported/tutorials/.
    Renders:

    • Introduction (hardcoded — lives in main repo)
    • Basic cases (configured via data file, link-only behavior preserved)
    • All tutorials (auto-discovered, alphabetically interleaved flat pages and groups)
  • _data/tutorial_sidebar_config.yml
    Centralizes editorial decisions: featured tutorials, subgroup definitions, display order, short title overrides.
    Only this file requires manual updates.

  • _data/sidebars/tutorial_sidebar.yml
    Preserved for reference but no longer used.

Result

  • New tutorial added → appears automatically in All tutorials
  • Featuring/grouping changes → edit _data/tutorial_sidebar_config.yml only
  • No additional front matter required in tutorial READMEs
  • All other sidebars remain unchanged

Hugo Migration

The configuration file structure is directly portable.
Template logic maps cleanly to Hugo (range where, GroupByParam).
No changes required to tutorial front matter.

Testing

  • Renamed and deleted tutorial_sidebar.yml → sidebar still renders
  • Verified layout matches hosted site

Note

  • The sidebar for other repos can be automated similarly while being completely Hugo migration safe and will close the issue completely. This refers to issue Sidebar elements from imported repositories #586.
  • Short names present in tutorial_sidebar.yml couldn't be replicated, its only possible if all the README.md of subfolders in imported/tutorials has those short names in its front matter.

Comparison

Hosted site

Hosted site sidebar

Local site

Local site sidebar

@MakisH MakisH added technical Technical issues on the website GSoC Contributed in the context of the Google Summer of Code labels Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSoC Contributed in the context of the Google Summer of Code technical Technical issues on the website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants