Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
duckpond.ch/_layouts/post.html
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
109 lines (98 sloc)
4 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
layout: default | |
--- | |
{% assign chars_left = 280 %} | |
{% assign url = site.url | append: page.url | uri_escape | replace: "%20", "%2520" %} | |
{% assign chars_left = chars_left | minus: 24 %} | |
{% assign via = site.twitter.username | uri_escape %} | |
{% assign chars_left = chars_left | minus: 16 %} | |
{% assign tags_raw = '' %} | |
{% assign tags_size = 0 %} | |
{% for tag in page.keywords %} | |
{% assign tag_final = tag | strip_html | strip_newlines | replace: ' ', '_' | strip %} | |
{% assign tag_size = tag_final | size %} | |
{% assign tags_size = tags_size | plus: tag_size | plus: 2 %} | |
{% if tags_size > 30 %} | |
{% break %} | |
{% endif %} | |
{% if forloop.first == true %} | |
{% assign tags_raw = tags_raw | append: tag_final %} | |
{% else %} | |
{% assign tags_raw = tags_raw | append: ',' | append: tag_final %} | |
{% endif %} | |
{% endfor %} | |
{% assign tags = tags_raw | uri_escape %} | |
{% assign chars_left = chars_left | minus: tags_size %} | |
{% assign intro = content | newline_to_br | strip_newlines | replace: '<br />', ' ' | strip_html | strip_newlines | replace: ',', '.' | replace: '!', '.' | replace: ':', '\.' | replace: '?', '\.' | split: '.' | first | strip %} | |
{% assign text = page.title | append: ': ' | append: intro | strip_html | strip_newlines | truncate: chars_left | uri_escape | strip %} | |
<div class="row"> | |
<div class="col-md-10 text-center"> | |
<span class="float-md-left"> | |
<span class="time">{{ page.date | date_to_string }}</span> | |
{% if page.categories %} | |
<span class="categories"> | |
» {% for category in page.categories %}<a href="/category/{{ category }}">{{ category }}</a>{% if forloop.last == false %}, {% endif %}{% endfor %} | |
</span> | |
{% endif %} | |
</span> | |
</div> | |
<div class="col-md-2 text-center social-media"> | |
<span class="float-md-right"> | |
<a class="reddit" href="https://www.reddit.com/submit?title={{ text }}&url={{ url }}"> | |
{% include img/reddit.svg %} | |
</a> | |
<a class="twitter" href="https://twitter.com/intent/tweet?text={{ text }}&url={{ url }}&hashtags={{ tags }}&via={{ via }}"> | |
{% include img/twitter.svg %} | |
</a> | |
</span> | |
</div> | |
</div> | |
<div class="post"> | |
{{ content }} | |
</div> | |
{% assign hasSimilar = '' %} | |
{% for post in site.posts %} | |
{% assign postHasSimilar = false %} | |
{% for tag in post.categories %} | |
{% for thisTag in page.categories %} | |
{% if postHasSimilar == false and hasSimilar.size < 6 and post != page and tag == thisTag %} | |
{% if hasSimilar.size == 0 %} | |
<div class="panel-body"> | |
<h4>Related Posts</h4> | |
<ul> | |
{% endif %} | |
<li class="relatedPost"> | |
<a href="{{ site.url }}{{ post.url }}">{{ post.title }}</a> | |
{% if post.categories %} | |
(Categories: {% for category in post.categories %}<a href="/category/{{ category }}">{{ category }}</a>{% if forloop.last == false %}, {% endif %}{% endfor %}) | |
{% endif %} | |
</li> | |
{% capture hasSimilar %}{{ hasSimilar }}*{% endcapture %} | |
{% assign postHasSimilar = true %} | |
{% endif %} | |
{% endfor %} | |
{% endfor %} | |
{% endfor %} | |
{% if hasSimilar.size > 0 %} | |
</ul> | |
</div> | |
{% endif %} | |
<div class="row post-navigation"> | |
<div class="col-md-6 text-center"> | |
<span class="float-md-left"> | |
{% if page.next.url %} | |
<a href="{{ page.next.url }}">« {{ page.next.title }} «</a> | |
{% endif %} | |
</span> | |
</div> | |
<div class="col-md-6 text-center"> | |
<span class="float-md-right"> | |
{% if page.previous.url %} | |
<a href="{{ page.previous.url }}">» {{ page.previous.title }} »</a> | |
{% endif %} | |
</span> | |
</div> | |
</div> | |
<div class="post-comment"> | |
<section id="isso-thread"></section> | |
</div> | |