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

✨ feat: support using info-page.html for sections #455

Merged
merged 4 commits into from
Jan 2, 2025

Conversation

wischi-chr
Copy link
Contributor

@wischi-chr wischi-chr commented Jan 2, 2025

Summary

This change makes it possible to use the info-page.html template on the root path ("/"), which in zola is always a "section" and can't be set to "page".

The related issue(s) is/are actually in zola and not really in tabi. It's a known limitation in zola that the root path has to be a section and can't be a page (see linked issues later). Because of that templates designed for pages typically can't be used for sections (and thus not as a root path "/" landing page).

Thankfully in tabi a lot of things are already pretty agnostic between sections and pages, so it only needed some minor tweaks to make the template work at the root level.

Related issues

As said before, not really a tabi issue, but here are related zola issues and discussions:

Slightly related (but very old / fixed / obsolete)

Changes

extra-features.html

Before this change, this partial failed to render for sections, because it called the macro evaluate_setting_priority with the section as page parameter which caused the line {%- for i in range(start=1, end=components | length) -%} to fail, because start (1) was larger than the end (0) parameter.

It looked to me like the section parameter was added later to evaluate_setting_priority (because it has a default value and the parameter documentation is missing) so I made a change in extra-features.html to pass page and section separately if they are set (or "" if they are not set).

info-page.html

I updated the info-page.html to also support both pages and sections.

Screenshots

Type of change

  • Bug fix (fixes an issue without altering functionality)
  • New feature (adds non-breaking functionality)
  • Breaking change (alters existing functionality)
    • Changes in extra-features.html should be backwards compatible, but I'm not 100% sure.
  • UI/UX improvement (enhances user interface without altering functionality)
  • Refactor (improves code quality without altering functionality)
  • Documentation update
  • Other (please describe below)

Checklist

  • I have verified the accessibility of my changes
  • I have tested all possible scenarios for this change
    • I don't think that's possible without manually checking all sites that use tabi 😄
  • I have updated theme.toml with a sane default for the feature
  • I have updated config.toml in tabi-start
  • I have made corresponding changes to the documentation:
    • Updated config.toml comments
    • Updated theme.toml comments
    • Updated "Mastering tabi" post in English
    • (Optional) Updated "Mastering tabi" post in Spanish
    • (Optional) Updated "Mastering tabi" post in Catalan

This change makes it possible to use the page-info.html template
on the root path "/", which in zola is always a "section" and can't
be set to "page".
@wischi-chr wischi-chr requested a review from welpo as a code owner January 2, 2025 15:13
Copy link

netlify bot commented Jan 2, 2025

Deploy Preview for tabi-demo ready!

Name Link
🔨 Latest commit 67c5d33
🔍 Latest deploy log https://app.netlify.com/sites/tabi-demo/deploys/6776f5714c1c9800088b0511
😎 Deploy Preview https://deploy-preview-455--tabi-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@welpo welpo added the enhancement New feature or request label Jan 2, 2025
@welpo
Copy link
Owner

welpo commented Jan 2, 2025

Thank you!

I tested using info-page.html for the main _index.md + the hierarchy with normal posts and series, and everything looks good.

@welpo welpo changed the title Section support for info-page.html ✨ feat: support using info-page.html for sections Jan 2, 2025
@welpo welpo merged commit 28fe074 into welpo:main Jan 2, 2025
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants