Skip to content

Commit

Permalink
Merge pull request #87 from Voog/52_year_number_behind_articles
Browse files Browse the repository at this point in the history
Year number behind articles
  • Loading branch information
Kaspar Naaber authored Apr 21, 2017
2 parents dfffb09 + 672171f commit d37a201
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 22 deletions.
3 changes: 3 additions & 0 deletions components/blog-article-variables.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% capture dont_render %}
{% assign current_year = "now" | date: "%Y" | to_num %}
{% endcapture %}
10 changes: 9 additions & 1 deletion components/post-box.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
<article class="post">
<header class="post-header">
<h2 class="post-title">{% if post-box == "article" %}{% editable article.title %}{% else %}<a href="{{ article.url }}">{{ article.title }}</a>{% endif %}</h2>
<time class="post-date" datetime="{{ article.created_at | date : "%Y-%m-%d" }}">{{ article.created_at | format_date : "long" }}</time>
{% assign article_year = article.created_at | format_date: "%Y" | to_num %}

{% if article_year == current_year %}
{% assign article_date_format = "long_without_year" %}
{% else %}
{% assign article_date_format = "long" %}
{% endif %}

<time class="post-date" datetime="{{ article.created_at | date: '%Y-%m-%d' }}">{{ article.created_at | format_date: article_date_format }}</time>
<div class="post-author">{{ article.author.name }}</div>
</header>

Expand Down
1 change: 1 addition & 0 deletions layouts/blog___news.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!DOCTYPE html>
{% include "blog-article-variables" %}
<html class="{% if editmode %}editmode{% else %}public{% endif %}" lang="{{ page.language_code }}">
<head prefix="og: http://ogp.me/ns#">
{% include "template-variables" %}
Expand Down
1 change: 1 addition & 0 deletions layouts/blog_article.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!DOCTYPE html>
{% include "blog-article-variables" %}
<html class="{% if editmode %}editmode{% else %}public{% endif %}" lang="{{ page.language_code }}">
<head prefix="og: http://ogp.me/ns#">
{% assign blog_article_page = true %}
Expand Down
47 changes: 27 additions & 20 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,27 @@
"layout_name": "blog_article",
"title": "Blog article"
},
{
"content_type": "component",
"component": true,
"file": "components/post-box.tpl",
"layout_name": "post-box",
"title": "post-box"
},
{
"content_type": "component",
"component": true,
"file": "components/footer.tpl",
"layout_name": "footer",
"title": "footer"
},
{
"content_type": "component",
"component": true,
"file": "components/header.tpl",
"layout_name": "header",
"title": "header"
},
{
"content_type": "component",
"component": true,
Expand Down Expand Up @@ -85,9 +106,9 @@
{
"content_type": "component",
"component": true,
"file": "components/post-box.tpl",
"layout_name": "post-box",
"title": "post-box"
"file": "components/comment-form.tpl",
"layout_name": "comment-form",
"title": "comment-form"
},
{
"content_type": "component",
Expand Down Expand Up @@ -181,25 +202,11 @@
"title": "topbar"
},
{
"title": "blog-article-variables",
"layout_name": "blog-article-variables",
"content_type": "component",
"component": true,
"file": "components/comment-form.tpl",
"layout_name": "comment-form",
"title": "comment-form"
},
{
"content_type": "component",
"component": true,
"file": "components/footer.tpl",
"layout_name": "footer",
"title": "footer"
},
{
"content_type": "component",
"component": true,
"file": "components/header.tpl",
"layout_name": "header",
"title": "header"
"file": "components/blog-article-variables.tpl"
}
],
"assets": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"devDependencies": {
"autoprefixer": "^6.7.7",
"grunt": "^1.0.1",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-clean": "^1.1.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-cssmin": "^2.0.0",
Expand Down

0 comments on commit d37a201

Please sign in to comment.