Fix showing background img with non-empty baseurl (#497)

* Fix showing background img with non-empty baseurl

Also switch globally to relative_url for all baseurl prepends,
which is more robust than custom URL mangling

* More site.baseurl -> relative_url conversion
This commit is contained in:
Abel Cheung 2019-06-08 13:34:33 +08:00 committed by Dean Attali
parent a666a9db52
commit 7b43e4061d
12 changed files with 28 additions and 28 deletions

View file

@ -8,7 +8,7 @@ use-site-title: true
<div class="posts-list">
{% for post in paginator.posts %}
<article class="post-preview">
<a href="{{ post.url | prepend: site.baseurl }}">
<a href="{{ post.url | relative_url }}">
<h2 class="post-title">{{ post.title }}</h2>
{% if post.subtitle %}
@ -25,7 +25,7 @@ use-site-title: true
<div class="post-entry-container">
{% if post.image %}
<div class="post-image">
<a href="{{ post.url | prepend: site.baseurl }}">
<a href="{{ post.url | relative_url }}">
<img src="{{ post.image }}">
</a>
</div>
@ -34,7 +34,7 @@ use-site-title: true
{{ post.excerpt | strip_html | xml_escape | truncatewords: site.excerpt_length }}
{% assign excerpt_word_count = post.excerpt | number_of_words %}
{% if post.content != post.excerpt or excerpt_word_count > site.excerpt_length %}
<a href="{{ post.url | prepend: site.baseurl }}" class="post-read-more">[Read&nbsp;More]</a>
<a href="{{ post.url | relative_url }}" class="post-read-more">[Read&nbsp;More]</a>
{% endif %}
</div>
</div>
@ -44,7 +44,7 @@ use-site-title: true
Tags:
{% if site.link-tags %}
{% for tag in post.tags %}
<a href="{{ site.baseurl }}/tags#{{- tag -}}">{{- tag -}}</a>
<a href="{{ '/tags' | relative_url }}#{{- tag -}}">{{- tag -}}</a>
{% endfor %}
{% else %}
{{ post.tags | join: ", " }}
@ -60,12 +60,12 @@ use-site-title: true
<ul class="pager main-pager">
{% if paginator.previous_page %}
<li class="previous">
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">&larr; Newer Posts</a>
<a href="{{ paginator.previous_page_path | relative_url }}">&larr; Newer Posts</a>
</li>
{% endif %}
{% if paginator.next_page %}
<li class="next">
<a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Older Posts &rarr;</a>
<a href="{{ paginator.next_page_path | relative_url }}">Older Posts &rarr;</a>
</li>
{% endif %}
</ul>