welpo / tabi

A modern Zola theme with search, multilingual support, optional JavaScript, a perfect Lighthouse score, and a focus on accessibility.
https://welpo.github.io/tabi/
MIT License
118 stars 38 forks source link

Incorrect handling of external URLs in `footer_menu` #212

Closed welpo closed 11 months ago

welpo commented 12 months ago

Bug Report

Environment

Zola version: 0.17.2
tabi commit: be218c0b6c521588cf57c1aa9d90db88aa24e801

Expected Behavior

When a user sets an external URL in the footer_menu configuration, the generated URL in the footer should correctly point to the external URL. It should not be treated as a relative URL.

Current Behavior

Currently, external URLs specified in footer_menu are treated as relative URLs. This results in incorrect URL paths for external links. For example, specifying https://example.com in config.toml under footer_menu generates a link that points to http://127.0.0.1:1111/https://example.com, which is incorrect.

Steps to Reproduce

  1. Edit config.toml and add an external URL in the footer_menu section. For example:
    footer_menu = [
        {url = "https://example.com" name = "external link", trailing_slash = false},
    ]
  2. Build the Zola site.
  3. Navigate to the footer of any page on the site.
  4. The link for the external URL will be incorrect, as it's treated as a relative URL.

This issue can easily be fixed with a Regex in the Tera template by adding an additional check for absolute URLs (i.e., those that begin with http:// or https://) and handling them differently from relative URLs.

joberthrogers18 commented 12 months ago

Hello @welpo, can I get this issue to solve?

welpo commented 12 months ago

Hello @welpo, can I get this issue to solve?

Certainly! Thanks, Joberth :)

welpo commented 11 months ago

@joberthrogers18 don't hesitate to reach out if you have any questions!

joberthrogers18 commented 11 months ago

@welpo I opened a PR fix the bug showed in this issue.