Skip to content

Commit 829b26b

Browse files
committed
Add support for newer-version-url (posts)
1 parent f03749e commit 829b26b

File tree

8 files changed

+150
-86
lines changed

8 files changed

+150
-86
lines changed

_includes/post-preview.html

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{%- assign currentPost = include.post -%}
2+
{%- assign buttonText = "Continue reading..." -%}
3+
{%- if include.buttonText -%}
4+
{%- assign buttonText = include.buttonText -%}
5+
{%- endif -%}
6+
<div class="post-preview">
7+
<a href="{{ currentPost.url }}" class="post-title-a">
8+
<h2 class="post-title">{{ currentPost.title }}</h2>
9+
{% if currentPost.subtitle %}
10+
<h3 class="post-subtitle">{{ currentPost.subtitle }}</h3>
11+
{% endif %}
12+
</a>
13+
<div class="post-meta">
14+
Posted by {% if currentPost.author %}{{ currentPost.author }}{% else %}{{ site.title }}{% endif %} on {{ currentPost.date | date: "%B %-d, %Y" }}
15+
{% comment %}<a href="{{ site.baseurl }}/{{ currentPost.url }}" data-disqus-identifier="{{ currentPost.url }}"></a>{% endcomment %} {% for
16+
lang in site.data.languages %} {% assign language = lang[1] %} {% if language.shortName == currentPost.lang %}
17+
<aside class="languages">
18+
<strong>Language: </strong>
19+
<a href="/languages/#{{ language.categoryName | slugify }}">{{ language.displayName }}</a>
20+
</aside>
21+
{% endif %} {% endfor %} {% if currentPost.proficiency-level %}
22+
<aside class="proficiency-level">
23+
<strong>Target proficiency level:</strong>
24+
25+
{% assign level = site.data.proficiency-levels[currentPost.proficiency-level] %}
26+
<a href="/levels/#proficiency-level-{{ currentPost.proficiency-level | slugify }}" title="{{ level.description }}"
27+
>{{ level.name }}</a
28+
>
29+
<small>({{ level.short-description }})</small>
30+
</aside>
31+
{% endif %} {% if currentPost.tags[0] %}
32+
<aside class="tags">
33+
<i class="glyphicon glyphicon-tags"></i>
34+
&nbsp; {% for tag in currentPost.tags %}
35+
<a href="/tags/#{{ tag | slugify }}" title='View posts tagged with "{{ tag }}"'><u>{{ tag }}</u></a
36+
>{% if forloop.last != true %}, {% endif %} {% endfor %}
37+
</aside>
38+
{% endif %}
39+
</div>
40+
41+
{% if currentPost.post-img %}
42+
<p><img src="{{ site.baseurl }}/{{ currentPost.post-img }}" alt="{{ currentPost.title }}" /></p>
43+
{% endif %} {%- include technology-relative-level-list.html technology-relative-level=currentPost.technology-relative-level -%}
44+
45+
<p>{{ currentPost.excerpt }}</p>
46+
<div class="post-readmore">
47+
<a
48+
href="{{ currentPost.url }}"
49+
title=""
50+
data-toggle="tooltip"
51+
data-placement="top"
52+
data-original-title="{{ currentPost.title }}{% if currentPost.subtitle %} | {{currentPost.subtitle}}{% endif %}"
53+
>{{ buttonText }}</a
54+
>
55+
</div>
56+
</div>

_layouts/post.html

+12
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,21 @@
1212
<div class="row">
1313
<main class="col-sm-12 post-content">
1414
<!-- Post Header -->
15+
{%- if page.newer-version-url -%}
16+
{%- assign newerPostVersion = site.posts | where: "url", page.newer-version-url | first -%}
17+
{%- if newerPostVersion -%}
18+
<aside class="new-article-version">
19+
<header>A newer version of this article is available</header>
20+
{%- comment -%} <a href="{{ page.newer-version-url }}">{{ newerPostVersion.title }} {{ newerPostVersion.subtitle }}</a>
21+
<p>{{ newerPostVersion.excerpt }}</p> {%- endcomment -%}
22+
{%- include post-preview.html post=newerPostVersion buttonText="Read the newer version..." -%}
23+
</aside>
24+
{%- endif -%}
25+
{%- endif -%}
1526
<header class="intro-header">
1627
<div class="hidden-xs intro-header-buy-net5-book">{%- include buy-net5-book.html -%}</div>
1728

29+
1830
<div class="post-heading">
1931
<h1>{{ page.title }}</h1>
2032
{% if page.subtitle %}

css/clean-blog.css

+15
Original file line numberDiff line numberDiff line change
@@ -1913,3 +1913,18 @@ pre,
19131913
.pinned-content img {
19141914
cursor: pointer !important;
19151915
}
1916+
aside.new-article-version {
1917+
border: 1px solid #007f00;
1918+
margin: 20px 0 70px;
1919+
padding: 20px;
1920+
border-radius: 50px;
1921+
}
1922+
aside.new-article-version > header {
1923+
font-weight: bold;
1924+
font-size: 2em;
1925+
text-align: center;
1926+
border-bottom: 1px dashed #007f00;
1927+
color: #007f00;
1928+
padding-bottom: 20px;
1929+
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
1930+
}

css/clean-blog.min.css

+15
Original file line numberDiff line numberDiff line change
@@ -1913,3 +1913,18 @@ pre,
19131913
.pinned-content img {
19141914
cursor: pointer !important;
19151915
}
1916+
aside.new-article-version {
1917+
border: 1px solid #007f00;
1918+
margin: 20px 0 70px;
1919+
padding: 20px;
1920+
border-radius: 50px;
1921+
}
1922+
aside.new-article-version > header {
1923+
font-weight: bold;
1924+
font-size: 2em;
1925+
text-align: center;
1926+
border-bottom: 1px dashed #007f00;
1927+
color: #007f00;
1928+
padding-bottom: 20px;
1929+
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
1930+
}

index.html

+2-53
Original file line numberDiff line numberDiff line change
@@ -7,59 +7,8 @@
77
<div class="post-list-container">
88
<section class="post-list">
99
{% for post in paginator.posts %}
10-
<div class="post-preview">
11-
<a href="{{ post.url }}" class="post-title-a">
12-
<h2 class="post-title">{{ post.title }}</h2>
13-
{% if post.subtitle %}
14-
<h3 class="post-subtitle">{{ post.subtitle }}</h3>
15-
{% endif %}
16-
</a>
17-
<div class="post-meta">
18-
Posted by {% if post.author %}{{ post.author }}{% else %}{{ site.title }}{% endif %} on {{ post.date | date: "%B %-d, %Y" }}
19-
{% comment %}<a href="{{ site.baseurl }}/{{ post.url }}" data-disqus-identifier="{{ post.url }}"></a>{% endcomment %} {% for
20-
lang in site.data.languages %} {% assign language = lang[1] %} {% if language.shortName == post.lang %}
21-
<aside class="languages">
22-
<strong>Language: </strong>
23-
<a href="/languages/#{{ language.categoryName | slugify }}">{{ language.displayName }}</a>
24-
</aside>
25-
{% endif %} {% endfor %} {% if post.proficiency-level %}
26-
<aside class="proficiency-level">
27-
<strong>Target proficiency level:</strong>
28-
29-
{% assign level = site.data.proficiency-levels[post.proficiency-level] %}
30-
<a href="/levels/#proficiency-level-{{ post.proficiency-level | slugify }}" title="{{ level.description }}"
31-
>{{ level.name }}</a
32-
>
33-
<small>({{ level.short-description }})</small>
34-
</aside>
35-
{% endif %} {% if post.tags[0] %}
36-
<aside class="tags">
37-
<i class="glyphicon glyphicon-tags"></i>
38-
&nbsp; {% for tag in post.tags %}
39-
<a href="/tags/#{{ tag | slugify }}" title='View posts tagged with "{{ tag }}"'><u>{{ tag }}</u></a
40-
>{% if forloop.last != true %}, {% endif %} {% endfor %}
41-
</aside>
42-
{% endif %}
43-
</div>
44-
45-
{% if post.post-img %}
46-
<p><img src="{{ site.baseurl }}/{{ post.post-img }}" alt="{{ post.title }}" /></p>
47-
{% endif %} {%- include technology-relative-level-list.html technology-relative-level=post.technology-relative-level -%}
48-
49-
<p>{{ post.excerpt }}</p>
50-
<div class="post-readmore">
51-
<a
52-
href="{{ post.url }}"
53-
title=""
54-
data-toggle="tooltip"
55-
data-placement="top"
56-
data-original-title="{{ post.title }}{% if post.subtitle %} | {{post.subtitle}}{% endif %}"
57-
>Continue reading...</a
58-
>
59-
{% comment %}| replace: '"', '&quot;'{% endcomment %}
60-
</div>
61-
</div>
62-
<hr />
10+
{%- include post-preview.html post=post -%}
11+
<hr />
6312
{% endfor %}
6413

6514
<!-- Pager -->

js/clean-blog.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

less/custom.less

+17
Original file line numberDiff line numberDiff line change
@@ -669,3 +669,20 @@ aside.book {
669669
cursor: pointer !important;
670670
}
671671
}
672+
673+
aside.new-article-version {
674+
border: 1px solid @brand-primary;
675+
margin: 20px 0 70px;
676+
padding: 20px;
677+
border-radius: 50px;
678+
679+
& > header {
680+
font-weight: bold;
681+
font-size: 2em;
682+
text-align: center;
683+
border-bottom: 1px dashed @brand-primary;
684+
color: @brand-primary;
685+
padding-bottom: 20px;
686+
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
687+
}
688+
}

package-lock.json

+32-32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)