correctly escape titles subtitles and excerpts in all contexts; fixes #856
This commit is contained in:
parent
24e182b90e
commit
505305ebe7
10 changed files with 23 additions and 22 deletions
|
@ -1,6 +1,7 @@
|
|||
## Unreleased version
|
||||
|
||||
- Added `post_search` config setting that creates a Search button in the navbar (older websites need to set `post_search: true` to enable this feature) (#770)
|
||||
- Fixed page titles, subtitles, and excerpts rendering correctly when there are special characeters in them (#856)
|
||||
- Slightly reworked margins and position for avatar image to resolve an alignment issue on Safari.
|
||||
- Changed the width at which the navbar collapses to a higher threshold because most modern non-mobile browsers are >1000px
|
||||
- Fixed bug where navbar secondary level dropdown items didn't inherit the same colour as the primary navbar links
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
<div class="row">
|
||||
<div class="col-xl-8 offset-xl-2 col-lg-10 offset-lg-1">
|
||||
<div class="{{ include.type }}-heading">
|
||||
<h1>{% if page.title %}{{ page.title }}{% else %}<br/>{% endif %}</h1>
|
||||
<h1>{% if page.title %}{{ page.title | strip_html }}{% else %}<br/>{% endif %}</h1>
|
||||
{% if page.subtitle %}
|
||||
{% if include.type == "page" %}
|
||||
<hr class="small">
|
||||
<span class="{{ include.type }}-subheading">{{ page.subtitle }}</span>
|
||||
<span class="{{ include.type }}-subheading">{{ page.subtitle | strip_html }}</span>
|
||||
{% else %}
|
||||
<h2 class="{{ include.type }}-subheading">{{ page.subtitle }}</h2>
|
||||
<h2 class="{{ include.type }}-subheading">{{ page.subtitle | strip_html }}</h2>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
@ -61,13 +61,13 @@
|
|||
<div class="row">
|
||||
<div class="col-xl-8 offset-xl-2 col-lg-10 offset-lg-1">
|
||||
<div class="{{ include.type }}-heading">
|
||||
<h1>{% if page.title %}{{ page.title }}{% else %}<br/>{% endif %}</h1>
|
||||
<h1>{% if page.title %}{{ page.title | strip_html }}{% else %}<br/>{% endif %}</h1>
|
||||
{% if page.subtitle %}
|
||||
{% if include.type == "page" %}
|
||||
<hr class="small">
|
||||
<span class="{{ include.type }}-subheading">{{ page.subtitle }}</span>
|
||||
<span class="{{ include.type }}-subheading">{{ page.subtitle | strip_html }}</span>
|
||||
{% else %}
|
||||
<h2 class="{{ include.type }}-subheading">{{ page.subtitle }}</h2>
|
||||
<h2 class="{{ include.type }}-subheading">{{ page.subtitle | strip_html }}</h2>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
var searchjson = '[ \
|
||||
{% for post in site.posts %} \
|
||||
{ \
|
||||
"title" : "{% if post.title != "" %}{{ post.title | escape }}{% else %}{{ post.excerpt | strip_html | escape | strip }}{%endif%}", \
|
||||
"title" : "{% if post.title != "" %}{{ post.title | strip_html | escape }}{% else %}{{ post.excerpt | strip_html | escape | strip }}{%endif%}", \
|
||||
"category" : "{{ post.tags | join: \', \' }}", \
|
||||
"url" : "{{ site.baseurl }}{{ post.url }}", \
|
||||
"date" : "{{ post.date | date: "%B %e, %Y" | default: "January 1, 1970" }}" \
|
||||
|
@ -19,7 +19,7 @@
|
|||
{% endfor %} \
|
||||
{% for page in site.html_pages %}{% if page.title != "{title}" and page.title != "404 - Page not found" %} \
|
||||
{ \
|
||||
"title" : "{% if page.title != "" %}{{ page.title | escape }}{% else %}{{ page.excerpt | strip_html | escape | strip }}{% endif %}", \
|
||||
"title" : "{% if page.title != "" %}{{ page.title | strip_html | escape }}{% else %}{{ page.excerpt | strip_html | escape | strip }}{% endif %}", \
|
||||
"category" : "{% if page.tags %}{{ page.tags | join: \', \' }}{% else %}page{% endif %}", \
|
||||
"url" : "{{ site.baseurl }}{{ page.url }}", \
|
||||
"date" : "{{ page.date | date: '%B %e, %Y' | default: "January 1, 1970" }}" \
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<span class="sr-only">Share: </span>
|
||||
|
||||
{% if site.share-links-active.twitter %}
|
||||
<a href="https://twitter.com/intent/tweet?text={{ page.title | url_encode }}&url={{ page.url | absolute_url | url_encode }}"
|
||||
<a href="https://twitter.com/intent/tweet?text={{ page.title | strip_html | url_encode }}&url={{ page.url | absolute_url | url_encode }}"
|
||||
class="btn btn-social-icon btn-twitter" title="Share on Twitter">
|
||||
<span class="fab fa-fw fa-twitter" aria-hidden="true"></span>
|
||||
<span class="sr-only">Twitter</span>
|
||||
|
|
|
@ -35,11 +35,11 @@ layout: page
|
|||
{% endif %}
|
||||
|
||||
<a href="{{ post.url | absolute_url }}">
|
||||
<h2 class="post-title">{{ post.title }}</h2>
|
||||
<h2 class="post-title">{{ post.title | strip_html }}</h2>
|
||||
|
||||
{% if post.subtitle %}
|
||||
<h3 class="post-subtitle">
|
||||
{{ post.subtitle }}
|
||||
{{ post.subtitle | strip_html }}
|
||||
</h3>
|
||||
{% endif %}
|
||||
</a>
|
||||
|
@ -68,7 +68,7 @@ layout: page
|
|||
|
||||
<div class="post-entry">
|
||||
{% assign excerpt_length = site.excerpt_length | default: 50 %}
|
||||
{{ post.excerpt | strip_html | xml_escape | truncatewords: excerpt_length }}
|
||||
{{ post.excerpt | strip_html | truncatewords: excerpt_length }}
|
||||
{% assign excerpt_word_count = post.excerpt | number_of_words %}
|
||||
{% if post.content != post.excerpt or excerpt_word_count > excerpt_length %}
|
||||
<a href="{{ post.url | absolute_url }}" class="post-read-more">[Read More]</a>
|
||||
|
|
|
@ -67,12 +67,12 @@ layout: base
|
|||
<ul class="pagination blog-pager">
|
||||
{% if page.previous.url %}
|
||||
<li class="page-item previous">
|
||||
<a class="page-link" href="{{ page.previous.url | relative_url }}" data-toggle="tooltip" data-placement="top" title="{{page.previous.title}}">← Previous Post</a>
|
||||
<a class="page-link" href="{{ page.previous.url | relative_url }}" data-toggle="tooltip" data-placement="top" title="{{page.previous.title | strip_html | xml_escape}}">← Previous Post</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if page.next.url %}
|
||||
<li class="page-item next">
|
||||
<a class="page-link" href="{{ page.next.url | relative_url }}" data-toggle="tooltip" data-placement="top" title="{{page.next.title}}">Next Post →</a>
|
||||
<a class="page-link" href="{{ page.next.url | relative_url }}" data-toggle="tooltip" data-placement="top" title="{{page.next.title | strip_html | xml_escape}}">Next Post →</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
---
|
||||
layout: post
|
||||
title: Flake it till you make it
|
||||
subtitle: Excerpt from Soulshaping by Jeff Brown
|
||||
title: "Flake it & un + he`<i>AA</i>`y <i>BB</i> : per g > % cent ' till y\"ou make it"
|
||||
subtitle: "Excerpt from \"Soul<i>ITTT</i>shaping by Jeff Brown"
|
||||
cover-img: /assets/img/path.jpg
|
||||
thumbnail-img: /assets/img/thumb.png
|
||||
share-img: /assets/img/path.jpg
|
||||
tags: [books, test]
|
||||
---
|
||||
|
||||
Under what circumstances should we step off a path? When is it essential that we finish what we start? If I bought a bag of peanuts and had an allergic reaction, no one would fault me if I threw it out. If I ended a relationship with a woman who hit me, no one would say that I had a commitment problem. But if I walk away from a seemingly secure route because my soul has other ideas, I am a flake?
|
||||
Under what & f < d > g + g : `<strong>g</strong>`y <strong>sg</strong> e % t ' c " circusmstances should we step off a path? When is it essential that we finish what we start? If I bought a bag of peanuts and had an allergic reaction, no one would fault me if I threw it out. If I ended a relationship with a woman who hit me, no one would say that I had a commitment problem. But if I walk away from a seemingly secure route because my soul has other ideas, I am a flake?
|
||||
|
||||
The truth is that no one else can definitively know the path we are here to walk. It’s tempting to listen—many of us long for the omnipotent other—but unless they are genuine psychic intuitives, they can’t know. All others can know is their own truth, and if they’ve actually done the work to excavate it, they will have the good sense to know that they cannot genuinely know anyone else’s. Only soul knows the path it is here to walk. Since you are the only one living in your temple, only you can know its scriptures and interpretive structure.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
layout: post
|
||||
title: Sample blog post
|
||||
subtitle: Each post also has a subtitle
|
||||
title: Sample blog <i>fds</i>post
|
||||
subtitle: Each post al<i>ITAL</i>so has a subtitle
|
||||
gh-repo: daattali/beautiful-jekyll
|
||||
gh-badge: [star, fork, follow]
|
||||
tags: [test]
|
||||
|
|
4
feed.xml
4
feed.xml
|
@ -15,9 +15,9 @@ layout: null
|
|||
{% assign excerpt_length = site.excerpt_length | default: 50 %}
|
||||
{% for post in site.posts limit:20 %}
|
||||
<item>
|
||||
<title>{{ post.title | xml_escape }}</title>
|
||||
<title>{{ post.title | strip_html | xml_escape }}</title>
|
||||
<description>
|
||||
{% if post.subtitle %}{{ post.subtitle | xml_escape }} - {% endif %}
|
||||
{% if post.subtitle %}{{ post.subtitle | strip_html | xml_escape }} - {% endif %}
|
||||
{{ post.content | strip_html | xml_escape | truncatewords: excerpt_length }}
|
||||
</description>
|
||||
<pubDate>{{ post.date | date: "%a, %d %b %Y %H:%M:%S %z" }}</pubDate>
|
||||
|
|
|
@ -25,7 +25,7 @@ title: 'Tag Index'
|
|||
<div class="post-list">
|
||||
{%- for post in site.tags[tag] -%}
|
||||
<div class="tag-entry">
|
||||
<a href="{{ post.url | relative_url }}">{{- post.title -}}</a>
|
||||
<a href="{{ post.url | relative_url }}">{{- post.title | strip_html -}}</a>
|
||||
<div class="entry-date">
|
||||
<time datetime="{{- post.date | date_to_xmlschema -}}">{{- post.date | date: date_format -}}</time>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue