From de91dfb0a706b6dcf2f4232c6cece7778e7d9fa2 Mon Sep 17 00:00:00 2001 From: Joberth Rogers Date: Tue, 31 Oct 2023 09:29:09 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(footer):=20fix=20external=20?= =?UTF-8?q?link=20redirection=20in=20footer=20(#219)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: welpo --- config.toml | 1 + content/blog/mastering-tabi-settings/index.ca.md | 1 + content/blog/mastering-tabi-settings/index.es.md | 1 + content/blog/mastering-tabi-settings/index.md | 1 + templates/partials/footer.html | 6 ++++++ theme.toml | 1 + 6 files changed, 11 insertions(+) diff --git a/config.toml b/config.toml index e77b15ceb..b0246a213 100644 --- a/config.toml +++ b/config.toml @@ -185,6 +185,7 @@ footer_menu = [ {url = "about", name = "about", trailing_slash = true}, # {url = "privacy", name = "privacy", trailing_slash = true}, {url = "sitemap.xml", name = "sitemap", trailing_slash = false}, + # {url = "https://example.com", name = "external link", trailing_slash = true}, ] # Enable a copyright notice for the footer, shown between socials and the "Powered by" text. diff --git a/content/blog/mastering-tabi-settings/index.ca.md b/content/blog/mastering-tabi-settings/index.ca.md index 875d81a11..34d1da392 100644 --- a/content/blog/mastering-tabi-settings/index.ca.md +++ b/content/blog/mastering-tabi-settings/index.ca.md @@ -534,6 +534,7 @@ footer_menu = [ {url = "about", name = "about", trailing_slash = true}, {url = "privacy", name = "privacy", trailing_slash = true}, {url = "sitemap.xml", name = "sitemap", trailing_slash = false}, + {url = "https://example.com", name = "external link", trailing_slash = true}, ] ``` diff --git a/content/blog/mastering-tabi-settings/index.es.md b/content/blog/mastering-tabi-settings/index.es.md index be0026039..8e6b60a0e 100644 --- a/content/blog/mastering-tabi-settings/index.es.md +++ b/content/blog/mastering-tabi-settings/index.es.md @@ -532,6 +532,7 @@ footer_menu = [ {url = "about", name = "about", trailing_slash = true}, {url = "privacy", name = "privacy", trailing_slash = true}, {url = "sitemap.xml", name = "sitemap", trailing_slash = false}, + {url = "https://example.com", name = "external link", trailing_slash = true}, ] ``` diff --git a/content/blog/mastering-tabi-settings/index.md b/content/blog/mastering-tabi-settings/index.md index efa0619e8..335aea8ba 100644 --- a/content/blog/mastering-tabi-settings/index.md +++ b/content/blog/mastering-tabi-settings/index.md @@ -536,6 +536,7 @@ footer_menu = [ {url = "about", name = "about", trailing_slash = true}, {url = "privacy", name = "privacy", trailing_slash = true}, {url = "sitemap.xml", name = "sitemap", trailing_slash = false}, + {url = "https://example.com", name = "external link", trailing_slash = true}, ] ``` diff --git a/templates/partials/footer.html b/templates/partials/footer.html index de74f9186..beb593bdd 100644 --- a/templates/partials/footer.html +++ b/templates/partials/footer.html @@ -70,6 +70,12 @@ {%- if menu.url == "sitemap.xml" -%} {%- set url = get_url(path=menu.url, trailing_slash=trailing_slash) -%} + {%- elif menu.url is starting_with("http") -%} + {%- if menu.trailing_slash -%} + {%- set url = menu.url ~ "/" -%} + {%- else -%} + {%- set url = menu.url -%} + {%- endif -%} {%- else -%} {%- set url = get_url(path=menu.url, lang=lang, trailing_slash=trailing_slash) -%} {%- endif -%} diff --git a/theme.toml b/theme.toml index 0542f6da9..24197c5e5 100644 --- a/theme.toml +++ b/theme.toml @@ -164,6 +164,7 @@ encode_plaintext_email = true # Setting is ignored if email is already encoded. # {url = "about", name = "about", trailing_slash = true}, # {url = "privacy", name = "privacy", trailing_slash = true}, # {url = "sitemap.xml", name = "sitemap", trailing_slash = false}, +# {url = "https://example.com", name = "external link", trailing_slash = true}, # ] # Enable a copyright notice for the footer, shown between socials and the "Powered by" text.