Optimize url filters

This commit is contained in:
Cotes Chung 2021-01-18 23:27:43 +08:00
parent ab0e3f6ee4
commit 75e9feb687
4 changed files with 7 additions and 7 deletions

View file

@ -13,16 +13,16 @@
</p> </p>
</div> </div>
<script src="{{ site.baseurl }}/assets/js/lib/jquery.disqusloader.min.js"></script> <script src="{{ '/assets/js/lib/jquery.disqusloader.min.js' | relative_url }}"></script>
<script> <script>
var options = { var options = {
scriptUrl: '//{{ site.disqus.shortname }}.disqus.com/embed.js', scriptUrl: '//{{ site.disqus.shortname }}.disqus.com/embed.js',
disqusConfig: function() { disqusConfig: function() {
this.page.url = '{{ site.url | append: site.baseurl | append: page.url }}'; this.page.url = '{{ page.url | absolute_url }}';
this.page.identifier = '{{ page.url }}'; this.page.identifier = '{{ page.url }}';
} }
}; };
$.disqusLoader('#disqus', options); $.disqusLoader('#disqus', options);
</script> </script>

View file

@ -11,7 +11,7 @@
<span class="share-label text-muted mr-1">{{ site.data.share.label }}</span> <span class="share-label text-muted mr-1">{{ site.data.share.label }}</span>
<span class="share-icons"> <span class="share-icons">
{% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %} {% capture title %}{{ page.title }} - {{ site.title }}{% endcapture %}
{% assign url = page.url | relative_url | prepend: site.url %} {% assign url = page.url | absolute_url %}
{% for share in site.data.share.platforms %} {% for share in site.data.share.platforms %}
{% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %} {% assign link = share.link | replace: 'TITLE', title | replace: 'URL', url %}

View file

@ -25,8 +25,8 @@
SimpleJekyllSearch({ SimpleJekyllSearch({
searchInput: document.getElementById('search-input'), searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('search-results'), resultsContainer: document.getElementById('search-results'),
json: '{{ site.baseurl }}/assets/js/data/search.json', json: '{{ '/assets/js/data/search.json' | relative_url }}',
searchResultTemplate: '{{ result_elem | strip_newlines }}', searchResultTemplate: '{{ result_elem | strip_newlines }}',
noResultsText: '{{ not_found }}' noResultsText: '{{ not_found }}'
}); });
</script> </script>

View file

@ -12,4 +12,4 @@ User-agent: *
Disallow: /norobots/ Disallow: /norobots/
Sitemap: {{ site.url | append: site.baseurl }}/sitemap.xml Sitemap: {{ '/sitemap.xml' | absolute_url }}