You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by gc...@apache.org on 2022/11/30 19:49:56 UTC
[allura] branch master updated: [#8477] added optional argument for macro canonical_tag to completely ignore the page param
This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/master by this push:
new 520c3bd99 [#8477] added optional argument for macro canonical_tag to completely ignore the page param
520c3bd99 is described below
commit 520c3bd99e20e841a9dc37ae7e848d1cc234a148
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Wed Nov 30 13:48:11 2022 -0600
[#8477] added optional argument for macro canonical_tag to completely ignore the page param
---
Allura/allura/templates/jinja_master/lib.html | 4 +++-
Allura/allura/templates/repo/tree.html | 4 ++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/Allura/allura/templates/jinja_master/lib.html b/Allura/allura/templates/jinja_master/lib.html
index 1a47884e2..9e1d34872 100644
--- a/Allura/allura/templates/jinja_master/lib.html
+++ b/Allura/allura/templates/jinja_master/lib.html
@@ -883,9 +883,11 @@ This page is based on some examples from Greg Schueler, <a href="mailto:greg@var
{%- do g.register_forge_js('js/prop-types.min.js', location=location) %}
{%- endmacro %}
-{% macro canonical_tag(page=None) %}
+{% macro canonical_tag(page=None, ignore_page=False) %}
{% if not page and not 'page=' in request.query_string %}
<link rel="canonical" href="{{ request.path_url }}" />
+ {% elif not page and ignore_page %}
+ <link rel="canonical" href="{{ request.path_url }}" />
{% else %}
{# in case is inherithed from a child template and has no access to a page value #}
{% set page = request.GET['page'] if not page and 'page=' in request.query_string else page %}
diff --git a/Allura/allura/templates/repo/tree.html b/Allura/allura/templates/repo/tree.html
index d4cc8d81d..ebe8df5c1 100644
--- a/Allura/allura/templates/repo/tree.html
+++ b/Allura/allura/templates/repo/tree.html
@@ -19,6 +19,10 @@
{% extends 'allura:templates/repo/repo_master.html' %}
{% do g.register_forge_css('css/forge/hilite.css') %}
+{% block head %}
+ {{ canonical_tag(ignore_page=True) }}
+{% endblock %}
+
{% block title %}
{{c.project.name}} / {{c.app.config.options.mount_label}}
/ {{commit.shorthand_id()}} {{path}}