Selaa lähdekoodia

Fix bug: Article title shows HTML if typogrify is enabled

If the title contains &, it will be surrounded by CSS class which messes
up the anchor link attributes.

So previous and next article links do not appear correctly.
Similarly, title in browser tab is also broken.
Talha Mansoor 11 vuotta sitten
vanhempi
commit
5b3a671524
1 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. 3 3
      templates/article.html

+ 3 - 3
templates/article.html

@@ -1,7 +1,7 @@
 {% extends 'base.html' %}
 {% extends 'base.html' %}
 
 
 {% block title %}
 {% block title %}
-{{ article.title }} {%if article.subtitle %} - {{ article.subtitle }} {% endif %} · {{ super() }}
+{{ article.title|striptags }} {%if article.subtitle %} - {{ article.subtitle }} {% endif %} · {{ super() }}
 {% endblock title %}
 {% endblock title %}
 
 
 {% block head_description %}
 {% block head_description %}
@@ -53,7 +53,7 @@
             <nav>
             <nav>
             <ul class="articles_timeline">
             <ul class="articles_timeline">
                 {% if previous_article %}
                 {% if previous_article %}
-                {% set ptitle = previous_article.title %}
+                {% set ptitle = previous_article.title|striptags %}
                 {% set pv_title = ptitle %}
                 {% set pv_title = ptitle %}
                     {%if previous_article.subtitle %} 
                     {%if previous_article.subtitle %} 
                         {% set pv_title = ptitle + ' ' +  '<small>' + previous_article.subtitle + '</small>' %}
                         {% set pv_title = ptitle + ' ' +  '<small>' + previous_article.subtitle + '</small>' %}
@@ -62,7 +62,7 @@
                 <li class="previous_article">« <a href="{{ SITEURL }}/{{ previous_article.url }}" title="Previous: {{ ptitle }}">{{ pv_title }}</a></li>
                 <li class="previous_article">« <a href="{{ SITEURL }}/{{ previous_article.url }}" title="Previous: {{ ptitle }}">{{ pv_title }}</a></li>
                 {% endif %}
                 {% endif %}
                 {% if next_article %}
                 {% if next_article %}
-                {% set ntitle = next_article.title %}
+                {% set ntitle = next_article.title|striptags %}
                 {% set nv_title = ntitle %}
                 {% set nv_title = ntitle %}
                     {%if next_article.subtitle %} 
                     {%if next_article.subtitle %} 
                         {% set nv_title = ntitle + ' ' +  '<small>' + next_article.subtitle + '</small>' %}
                         {% set nv_title = ntitle + ' ' +  '<small>' + next_article.subtitle + '</small>' %}