Skip to content

Commit

Permalink
Merge pull request #67 from Voog/30_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 11, 2017
2 parents 756cf4a + 00f255a commit bac8941
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 17 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"name": "voog-design-rotterdam",
"devDependencies": {
"bourbon": "^4.3.4",
"jquery": "^3.1.1"
"jquery": "^3.2.1"
}
}
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 %}
13 changes: 11 additions & 2 deletions layouts/blog___news.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
{% include "template-variables" %}
{% 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_list = true %}
Expand All @@ -22,13 +23,21 @@
<article class="post">
<header class="post-header">
<h1 class="post-title"><a href="{{ article.url }}">{{ article.title }}</a></h1>
<time datetime="{{ article.created_at | date : "%Y-%m-%d" }}" class="post-date">{{ article.created_at | format_date : "%b %d, %Y" }}</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>
</header>

<section class="post-content">
<div class="post-excerpt content-formatted cfx">{{ article.excerpt }}</div>
<div class="post-body content-formatted cfx">{{ article.body }}</div>
<div class="post-readmore"><a class="post-read-more-btn" href="{{ article.url }}">{{ "read_more" | lc }}</a></div>
<div class="post-readmore"><a class="post-read-more-btn" href="{{ article.url }}">{{ "read_more" | lc }}</a></div>
</section>
</article>
{% endfor %}
Expand Down
11 changes: 10 additions & 1 deletion layouts/blog_article.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
{% include "template-variables" %}
{% 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 = true %}
Expand All @@ -14,7 +15,15 @@
<article class="post">
<header class="post-header content-formatted cfx">
<h1 class="post-title" data-search-indexing-allowed="true">{% editable article.title %}</h1>
<time class="post-date" datetime="{{ article.created_at | date : "%Y-%m-%d" }}">{{ article.created_at | format_date : "%B %d, %Y" }}</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>
</header>
<section class="post-content" data-search-indexing-allowed="true">
<div class="post-excerpt content-formatted cfx" {{ edy_intro_edit_text }}>{% editable article.excerpt %}</div>
Expand Down
33 changes: 20 additions & 13 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
{
"content_type": "page",
"component": false,
"file": "layouts/front_page.tpl",
"layout_name": "page_front",
"title": "Front page"
"file": "layouts/common_page.tpl",
"layout_name": "page_default",
"title": "Common page"
},
{
"content_type": "page",
"component": false,
"file": "layouts/common_page.tpl",
"layout_name": "page_default",
"title": "Common page"
"file": "layouts/front_page.tpl",
"layout_name": "page_front",
"title": "Front page"
},
{
"content_type": "blog",
Expand All @@ -33,6 +33,13 @@
"layout_name": "blog_article",
"title": "Blog article"
},
{
"content_type": "component",
"component": true,
"file": "components/edicy-tools-styles.tpl",
"layout_name": "edicy-tools-styles",
"title": "edicy-tools-styles"
},
{
"content_type": "component",
"component": true,
Expand Down Expand Up @@ -222,6 +229,13 @@
"layout_name": "topbar",
"title": "topbar"
},
{
"content_type": "component",
"component": true,
"file": "components/blog-article-variables.tpl",
"layout_name": "blog-article-variables",
"title": "blog-article-variables"
},
{
"content_type": "component",
"component": true,
Expand All @@ -235,13 +249,6 @@
"file": "components/comments-article.tpl",
"layout_name": "comments-article",
"title": "comments-article"
},
{
"content_type": "component",
"component": true,
"file": "components/edicy-tools-styles.tpl",
"layout_name": "edicy-tools-styles",
"title": "edicy-tools-styles"
}
],
"assets": [
Expand Down

0 comments on commit bac8941

Please sign in to comment.