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

nav_list empty links #5021

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

karmaniverous
Copy link
Contributor

@karmaniverous karmaniverous commented Oct 30, 2024

This is an enhancement or feature.

Summary

An empty-string child url in nav_list should produce an unlinked title.

Context

By default, a nav_list child entry without a link defaults to a link to the current page.

There are times when what you really want is NO link. See the sidebar here for an example. To maintain backwards compatibility, this change enables this behavior only when the url property is explicitly set to an empty string, like this:

entity-manager:
  - title: Packages
    children:
      - title: <strong><code>entity-manager</code></strong>
        url: '' # 👈 THIS!
      - title: <i class="fa-brands fa-github fa-lg"></i>&nbsp;&nbsp;GitHub
        url: https://github.com/karmaniverous/entity-manager
      - title: <i class="fa-solid fa-heart fa-lg"></i>&nbsp;&nbsp;NPM
        url: https://www.npmjs.com/package/@karmaniverous/entity-manager
      - title: <i class="fa-solid fa-book fa-lg"></i>&nbsp;&nbsp;API
        url: https://docs.karmanivero.us/entity-manager/
      - title: <i class="fa-solid fa-comment fa-lg"></i>&nbsp;&nbsp;Help
        url: https://github.com/karmaniverous/entity-manager/discussions

@iBug
Copy link
Collaborator

iBug commented Nov 9, 2024

What about replacing "empty URL" with either null or false, so that {% if child.url == "" %} can be written as {% if child.url %}? I also think these are more explicit than an empty string.

@karmaniverous
Copy link
Contributor Author

I was concerned about backwards compatibility. I think if you make that change a bunch of people my find their existing links no longer working as expected.

@iBug iBug marked this pull request as draft November 18, 2024 17:33
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