Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site template: Escape title and description where it is used in HTML #4606

Merged
merged 1 commit into from
Feb 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/site_template/_includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<div class="wrapper">

<h2 class="footer-heading">{{ site.title }}</h2>
<h2 class="footer-heading">{{ site.title | escape }}</h2>

<div class="footer-col-wrapper">
<div class="footer-col footer-col-1">
<ul class="contact-list">
<li>{{ site.title }}</li>
<li>{{ site.title | escape }}</li>
<li><a href="mailto:{{ site.email }}">{{ site.email }}</a></li>
</ul>
</div>
Expand All @@ -29,7 +29,7 @@ <h2 class="footer-heading">{{ site.title }}</h2>
</div>

<div class="footer-col footer-col-3">
<p>{{ site.description }}</p>
<p>{{ site.description | escape }}</p>
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions lib/site_template/_includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>{% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %}</title>
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description | escape }}{% endif %}">

<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}">
<link rel="alternate" type="application/rss+xml" title="{{ site.title | escape }}" href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}">
</head>
4 changes: 2 additions & 2 deletions lib/site_template/_includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div class="wrapper">

<a class="site-title" href="{{ site.baseurl }}/">{{ site.title }}</a>
<a class="site-title" href="{{ site.baseurl }}/">{{ site.title | escape }}</a>

<nav class="site-nav">
<a href="#" class="menu-icon">
Expand All @@ -16,7 +16,7 @@
<div class="trigger">
{% for my_page in site.pages %}
{% if my_page.title %}
<a class="page-link" href="{{ my_page.url | prepend: site.baseurl }}">{{ my_page.title }}</a>
<a class="page-link" href="{{ my_page.url | prepend: site.baseurl }}">{{ my_page.title | escape }}</a>
{% endif %}
{% endfor %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion lib/site_template/_layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<article class="post">

<header class="post-header">
<h1 class="post-title">{{ page.title }}</h1>
<h1 class="post-title">{{ page.title | escape }}</h1>
</header>

<div class="post-content">
Expand Down
2 changes: 1 addition & 1 deletion lib/site_template/_layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">

<header class="post-header">
<h1 class="post-title" itemprop="name headline">{{ page.title }}</h1>
<h1 class="post-title" itemprop="name headline">{{ page.title | escape }}</h1>
<p class="post-meta"><time datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">{{ page.date | date: "%b %-d, %Y" }}</time>{% if page.author %} • <span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">{{ page.author }}</span></span>{% endif %}</p>
</header>

Expand Down
2 changes: 1 addition & 1 deletion lib/site_template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1 class="page-heading">Posts</h1>
<span class="post-meta">{{ post.date | date: "%b %-d, %Y" }}</span>

<h2>
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title | escape }}</a>
</h2>
</li>
{% endfor %}
Expand Down