Browse code

Merge pull request #8 from elliottt/stop-escaping-slashes-with-safe

Add `safe` to url outputs

Vincent Prouillet authored on 22/09/2018 02:33:51 • GitHub committed on 22/09/2018 02:33:51
Showing 5 changed files

... ...
@@ -11,7 +11,7 @@
11 11
         <ul>
12 12
             {% for term in terms %}
13 13
                 <li>
14
-                    <a href="{{ term.permalink }}">{{ term.name }}</a>({{ term.pages | length }})
14
+                    <a href="{{ term.permalink | safe }}">{{ term.name }}</a>({{ term.pages | length }})
15 15
                 </li>
16 16
             {% endfor %}
17 17
         </ul>
... ...
@@ -12,11 +12,11 @@
12 12
       <title>{% block title %}{{ config.title }}{% endblock title %}</title>
13 13
 
14 14
       {% if config.generate_rss %}
15
-        <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml") }}">
15
+        <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ get_url(path="rss.xml") | safe }}">
16 16
       {% endif %}
17 17
 
18 18
       {% block css %}
19
-          <link rel="stylesheet" href="{{ get_url(path="site.css", trailing_slash=false) }}">
19
+          <link rel="stylesheet" href="{{ get_url(path="site.css", trailing_slash=false) | safe }}">
20 20
       {% endblock css %}
21 21
 
22 22
       {% block extra_head %}
... ...
@@ -32,7 +32,7 @@
32 32
                         {% for item in config.extra.after_dark_menu %}
33 33
                             <a itemprop="url"
34 34
                                class="{% if item.url | replace(from="$BASE_URL", to=config.base_url) == current_url %}active{% endif %}"
35
-                               href="{{ item.url | replace(from="$BASE_URL", to=config.base_url) }}">
35
+                               href="{{ item.url | safe | replace(from="$BASE_URL", to=config.base_url) }}">
36 36
                                 <span itemprop="name">{{ item.name }}
37 37
                                 </span></a>
38 38
                         {% endfor %}
... ...
@@ -21,12 +21,12 @@
21 21
                 {% endif %}
22 22
                 {% if page.taxonomies.categories %}
23 23
                     {% set category = page.taxonomies.categories[0] %}
24
-                    in <a href="{{ get_taxonomy_url(kind="categories", name=category) }}">{{ category }}</a>
24
+                    in <a href="{{ get_taxonomy_url(kind="categories", name=category) | safe }}">{{ category }}</a>
25 25
                 {% endif %}
26 26
                 {% if page.taxonomies.tags %}
27 27
                     and tagged
28 28
                     {% for tag in page.taxonomies.tags %}
29
-                        <a href="{{ get_taxonomy_url(kind="tags", name=tag) }}">{{ tag }}</a>
29
+                        <a href="{{ get_taxonomy_url(kind="tags", name=tag) | safe }}">{{ tag }}</a>
30 30
                         {% if page.taxonomies.tags | length > 1 %}
31 31
                             {% if loop.index != page.taxonomies.tags | length %}
32 32
                                 {% if loop.index == page.taxonomies.tags | length - 1 %}
... ...
@@ -19,14 +19,14 @@
19 19
     <article itemscope itemtype="http://schema.org/CreativeWork">
20 20
         <header>
21 21
             <h2 itemprop="name">
22
-                <a href="{{ page.permalink }}">{{ page.title }}</a>
22
+                <a href="{{ page.permalink | safe }}">{{ page.title }}</a>
23 23
             </h2>
24 24
             <span class="muted">{{ self::meta(page=page) }}</span>
25 25
         </header>
26 26
         {% if page.summary %}
27 27
             <div itemprop="summary">
28 28
                 {{ page.summary | safe }}
29
-                <nav class="readmore"><a itemprop="url" href="{{ page.permalink }}">Read More&nbsp;&raquo;</a></nav>
29
+                <nav class="readmore"><a itemprop="url" href="{{ page.permalink | safe }}">Read More&nbsp;&raquo;</a></nav>
30 30
             </div>
31 31
         {% endif %}
32 32
     </article>
... ...
@@ -10,7 +10,7 @@
10 10
     {% if terms %}
11 11
         <ul>
12 12
             {% for term in terms %}
13
-                <li><a href="{{ term.permalink }}">{{ term.name }}</a> ({{ term.pages | length }})</li>
13
+                <li><a href="{{ term.permalink | safe }}">{{ term.name }}</a> ({{ term.pages | length }})</li>
14 14
             {% endfor %}
15 15
         </ul>
16 16
     {% endif %}