Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- layout: default
- ---
- <article class="post">
- <h1 class="post-title">{{ page.title }}</h1>
- <time datetime="{{ page.date | date_to_xmlschema }}" class="post-date">{{ page.date | date_to_string }}</time>
- {{ content }}
- </article>
- <aside class="related">
- {% if site.related_posts != empty %}
- {% assign maxRelated = 3 %}
- {% assign minCommonTags = 1 %}
- {% assign maxRelatedCounter = 0 %}
- <h3>Похожие посты</h3>
- <ul class="related-posts">
- {% for post in site.posts %}
- {% assign sameTagCount = 0 %}
- {% assign commonTags = '' %}
- {% for category in post.categories %}
- {% if post.url != page.url %}
- {% if page.categories contains category %}
- {% assign sameTagCount = sameTagCount | plus: 1 %}
- {% capture tagmarkup %} {% endcapture %}
- {% assign commonTags = commonTags | append: tagmarkup %}
- {% endif %}
- {% endif %}
- {% endfor %}
- {% if sameTagCount >= minCommonTags %}
- <li><a href="{{ site.baseurl }}{{ post.url }}">
- {{ post.title }}{{ commonTags }}
- <small><time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date_to_string }}</time></small>
- </a></li>
- {% assign maxRelatedCounter = maxRelatedCounter | plus: 1 %}
- {% if maxRelatedCounter >= maxRelated %}
- {% break %}
- {% endif %}
- {% endif %}
- {% endfor %}
- {% if sameTagCount == 0 %} {% for post in site.related_posts limit:3 %}
- <li>
- <a href="{{ site.baseurl }}{{ post.url }}">
- {{ post.title }}
- <small><time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date_to_string }}</time></small>
- </a>
- </li>
- {% endfor %} {% endif %}
- </ul>
- </aside>
- {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement