fix(#744): Escape special characters in title (#745)

This commit is contained in:
Dmitry 2020-11-27 21:58:24 +02:00 committed by GitHub
parent 8b41236317
commit e8de7726c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -6,6 +6,7 @@
- Fixed bug where using an image as a navbar title did not render in GitHub Project pages that did not have a custom domain - Fixed bug where using an image as a navbar title did not render in GitHub Project pages that did not have a custom domain
- Fixed issue where image thumbnails on the feed page were always forced into a square rather than maintaining a proper image aspect ratio - Fixed issue where image thumbnails on the feed page were always forced into a square rather than maintaining a proper image aspect ratio
- Added support for Patreon in the social network links in the footer - Added support for Patreon in the social network links in the footer
- Fixed bug where special characters in the title led to broken share tags (#744)
## v5.0.0 (2020-09-15) ## v5.0.0 (2020-09-15)

View File

@ -4,19 +4,19 @@
{% capture title %} {% capture title %}
{%- if page.share-title -%} {%- if page.share-title -%}
{{ page.share-title }} {{ page.share-title | strip_html | xml_escape }}
{%- elsif page.title -%} {%- elsif page.title -%}
{{ page.title }} {{ page.title | strip_html | xml_escape }}
{%- else -%} {%- else -%}
{{ site.title }} {{ site.title | strip_html | xml_escape }}
{%- endif -%} {%- endif -%}
{% endcapture %} {% endcapture %}
{% capture description %} {% capture description %}
{%- if page.share-description -%} {%- if page.share-description -%}
{{ page.share-description }} {{ page.share-description | strip_html | xml_escape }}
{%- elsif page.subtitle -%} {%- elsif page.subtitle -%}
{{ page.subtitle }} {{ page.subtitle | strip_html | xml_escape }}
{%- else -%} {%- else -%}
{%- assign excerpt_length = site.excerpt_length | default: 50 -%} {%- assign excerpt_length = site.excerpt_length | default: 50 -%}
{{ page.content | strip_html | xml_escape | truncatewords: excerpt_length | strip }} {{ page.content | strip_html | xml_escape | truncatewords: excerpt_length | strip }}