Skip to content

Conversation

homelab-alpha
Copy link
Contributor

@homelab-alpha homelab-alpha commented Apr 21, 2025

PR: Enable or disable the landing page via configuration

✨ Feature: Toggle for the landing page

This change introduces a new configuration option in hugo.toml that allows you to easily enable or disable the landing page. It adds flexibility for environments where a direct redirect to /docs/ is preferred.

🔧 Added configuration

Enable landing page (default) No action required. The landing page will be shown as usual.

[params.landingpage]
  enabled = true # Default value: true

Disable landing page Set enabled to false. Visitors will then be automatically redirected to /docs/.

[params.landingpage]
  enabled = false

🛠 Updated logic

The logic in layouts/index.html has been updated to check whether the landing page is disabled. If enabled = false, it performs an automatic redirect to /docs/. Otherwise, the landing page is rendered based on the data in data/landing.yaml.

✅ Changes

  • Added new landingpage.enabled parameter to hugo.toml
  • Conditional rendering in layouts/index.html based on this parameter
  • Redirect to /docs/ if landing page is disabled

🔍 Checklist

  • Code tested and works as expected
  • No new errors or warnings
  • No additional documentation required (the configuration is self-explanatory)

🎨 Dark mode

  • The UI has been tested both in dark and light mode
  • This PR does not change the UI (by default NO)

🔗 Related Issues and/or Discussions

Issues

Discussions

- Introduced the `[params.landingpage]` parameter in `hugo.toml` to control the visibility of the landing page.
- Modified `layouts/index.html` to respect the `landingpage.enabled` parameter.
- Default behavior remains: Landing Page enabled `enabled = true`.
- Setting `enabled = false` disables the landing page, redirecting users to `/docs/`.

modified: exampleSite/hugo.toml
modified: layouts/index.html
Copy link

netlify bot commented Apr 21, 2025

Deploy Preview for hugo-lotusdocs ready!

Name Link
🔨 Latest commit cfbf54f
🔍 Latest deploy log https://app.netlify.com/projects/hugo-lotusdocs/deploys/683dd9d89b9ef70008ef55e7
😎 Deploy Preview https://deploy-preview-227--hugo-lotusdocs.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 project configuration.

@homelab-alpha homelab-alpha marked this pull request as ready for review April 21, 2025 09:51
@colinwilson colinwilson added the enhancement New feature or request label Jun 2, 2025
@colinwilson colinwilson added this to the v0.3.0 milestone Jun 2, 2025
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.

Disabling landing page
2 participants