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

BUG navbar-logo does not recognize additional html pages #1647

Open
Charlie-XIAO opened this issue Jan 15, 2024 · 2 comments
Open

BUG navbar-logo does not recognize additional html pages #1647

Charlie-XIAO opened this issue Jan 15, 2024 · 2 comments
Labels
kind: bug Something isn't working

Comments

@Charlie-XIAO
Copy link
Contributor

It seems that if I have a page in html_additional_pages, e.g.,

html_additional_pages = {"index": "index.html"}

then hasdoc("index") returns False while pathto("index") can give the correct relative path. Hence the current logic (as follows) would treat "index" as an external URL.

{% if not theme_logo.get("link") %}
  {% set href = pathto(root_doc) %}
{% elif hasdoc(theme_logo.get("link")) %}
  {% set href = pathto(theme_logo.get("link")) %} {# internal page #}
{% else %}
  {% set href = theme_logo.get("link") %} {# external url #}
{% endif %}

Is there a workaround for this, or is it possible to fix this?

@12rambau
Copy link
Collaborator

I guess the easiest would be to check the path itself xith a jinja filter to detect relative and absolute path. I checked rapidely on the web and didn't find any so the easiest way to proceed is to build a custom filter to wire "abspath" in the layout.

@choldgraf
Copy link
Collaborator

choldgraf commented Jan 18, 2024

Could we just do a check for something like "if the file at pathto(theme_logo.get("link")) exists, then trigger the second elif block" (instead of using hasdoc at all)? I wonder if you could use the "file" version of pathto (where you do pathto("filepath", 1)) to avoid it converting your path to html?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants