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

refactor: render sidebar from data #376

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft

refactor: render sidebar from data #376

wants to merge 25 commits into from

Conversation

imfing
Copy link
Owner

@imfing imfing commented Apr 29, 2024

this is a major refactor aiming to address the sidebar performance issue described in #122

  • enable render the sidebar from a nested data, e.g. data/en/sidebar.yaml:
docs:
  - title: Documentation
    link: /docs/
  - title: Guide
    link: /docs/guide/
    open: false
    items:
      - title: Organize Files
        link: /docs/guide/organize-files/
  • add optional flags to enable caching the sidebar (experimental)
params:
  page:
    sidebar:
      enable: true
      source: data  # auto | data
      cache: true
  • when sidebar is cached, use JavaScript to expand sidebar automatically to the current page

The other related issue #254

Copy link

netlify bot commented Apr 29, 2024

Deploy Preview for hugo-hextra ready!

Name Link
🔨 Latest commit f8e02e6
🔍 Latest deploy log https://app.netlify.com/sites/hugo-hextra/deploys/677320eb3199830008d3cafa
😎 Deploy Preview https://deploy-preview-376--hugo-hextra.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.

@thangisme
Copy link
Contributor

not trying to rush or anything, but is there any ETA on this?

@imfing
Copy link
Owner Author

imfing commented Jan 14, 2025

not trying to rush or anything, but is there any ETA on this?

I'm trying to release it in the next version (0.10 hopefully)

The majority of the implementation has been done in this PR. Currently it needs to be manually tested to make sure things are working as expected

@imfing
Copy link
Owner Author

imfing commented Jan 21, 2025

╰─❯ hugo server
Watching for changes in /home/thang/Dev/Web/sample/{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in /home/thang/Dev/Web/sample/hugo.yaml, /home/thang/Dev/Web/sample/go.mod
Start building sites … 
hugo v0.139.3+extended+withdeploy linux/amd64 BuildDate=unknown VendorInfo=nixpkgs

ERROR render of "page" failed: "/home/thang/Dev/Web/sample/layouts/blog/single.html:3:7": execute of template failed: template: blog/single.html:3:7: executing "main" at <partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true)>: error calling partial: "/home/thang/Dev/Web/sample/themes/hextra/layouts/partials/sidebar.html:18:20": execute of template failed: template: partials/sidebar.html:18:20: executing "partials/sidebar.html" at <partialCached "components/sidebar/generate-mobile-data" site.Home site.Home>: error calling partialCached: "/home/thang/Dev/Web/sample/themes/hextra/layouts/partials/components/sidebar/generate-mobile-data.html:23:89": execute of template failed: template: partials/components/sidebar/generate-mobile-data.html:23:89: executing "partials/components/sidebar/generate-mobile-data.html" at <unmarshal>: error calling unmarshal: unknown format
Built in 28688 ms
Error: error building site: render: failed to render pages: render of "page" failed: "/home/thang/Dev/Web/sample/layouts/blog/single.html:3:7": execute of template failed: template: blog/single.html:3:7: executing "main" at <partial "sidebar.html" (dict "context" . "disableSidebar" true "displayPlaceholder" true)>: error calling partial: "/home/thang/Dev/Web/sample/themes/hextra/layouts/partials/sidebar.html:18:20": execute of template failed: template: partials/sidebar.html:18:20: executing "partials/sidebar.html" at <partialCached "components/sidebar/generate-mobile-data" site.Home site.Home>: error calling partialCached: "/home/thang/Dev/Web/sample/themes/hextra/layouts/partials/components/sidebar/generate-mobile-data.html:23:89": execute of template failed: template: partials/components/sidebar/generate-mobile-data.html:23:89: executing "partials/components/sidebar/generate-mobile-data.html" at <unmarshal>: error calling unmarshal: unknown format

need to investigate the above issue

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