changeset 9b09211bd34f in www.tryton.org:default
details: https://hg.tryton.org/www.tryton.org?cmd=changeset;node=9b09211bd34f
description:
        Use canonical URL for Open Graph
diffstat:

 templates/layout.html |  12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (36 lines):

diff -r 4beaf3d17ffe -r 9b09211bd34f templates/layout.html
--- a/templates/layout.html     Sat Jan 11 19:00:19 2020 +0100
+++ b/templates/layout.html     Sun Jan 12 16:22:45 2020 +0100
@@ -2,6 +2,9 @@
 <html lang="en" prefix="og: http://ogp.me/ns#";>
     <head>
         {% block head %}
+        {%- if canonical is not defined %}
+        {%- set canonical = url_for_canonical() %}
+        {%- endif %}
         <meta charset="utf-8"/>
         <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
         <meta name="viewport" content="width=device-width, initial-scale=1"/>
@@ -10,11 +13,7 @@
         <meta name="author" content="Tryton"/>
         <meta property="og:title" content="{{ title }}"/>
         <meta property="og:type" content="website"/>
-        {% if request.endpoint and request.endpoint != 'static' %}
-        <meta property="og:url" content="{{ url_for(request.endpoint, 
_external=True, **request.view_args) }}"/>
-        {% else %}
-        <meta property="og:url" content="{{ request.url }}"/>
-        {% endif %}
+        <meta property="og:url" content="{{ canonical }}"/>
         <meta property="og:image" content="{{ url_for('static', filename=(logo 
or 'images/logo.png'), _external=True, _scheme='http') }}"/>
         <meta property="og:image:secure_url" content="{{ url_for('static', 
filename=(logo or 'images/logo.png'), _external=True, _scheme='https') }}"/>
         {% if description %}
@@ -31,9 +30,6 @@
 
         <title>Tryton - {{ title }}</title>
         <link rel="shortcut icon" type="image/png" href="{{ url_for('static', 
filename='images/favicon.ico') }}"/>
-        {%- if canonical is not defined %}
-        {%- set canonical = url_for_canonical() %}
-        {%- endif %}
         {% if canonical != request.url %}
         <link rel="canonical" href="{{ canonical }}"/>
         {% endif %}

Reply via email to