Skip to content

Commit

Permalink
Add support for last-modified at plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
batlab committed Feb 14, 2017
1 parent 615665e commit 0d21253
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ gem 'jekyll-feed'
gem 'redcarpet'

group :jekyll_plugins do
gem 'jekyll-livereload'
gem 'jekyll-livereload'
gem 'jekyll-last-modified-at'
end
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ nav_ext_links:
- name: Link 2
url: http://wallabag.org/
```
#### Plugins
Academic is compatible with the `jekyll-last-modified-at` plugin ([repo](https://github.com/gjtorikian/jekyll-last-modified-at)). If installed, the last modified date will be (discretely) displayed in the posts lists and in the post layout.

If you specified a Github `repo`, the last modified date will point to the revision history of the file.

### Layouts

Expand Down
27 changes: 27 additions & 0 deletions _includes/last_modified_at.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% assign object = include.object %}

{% if object.last_modified_at %}


{% assign last = object.last_modified_at | date: '%Y%m%d' %}
{% assign created = object.date | date: '%Y%m%d' %}

{% if last != created %}
<span class="last-update">·

{% if site.repo %}
<a title="Voir l'historique des révisions de ce billet"
href="{{site.repo}}/commits/master/{{object.path}}">
{% endif %}

mis à jour le {% include date.html date=object.last_modified_at %}

{% if site.repo %}
</a>
{% endif %}

</span>
{% endif %}


{% endif %}
1 change: 1 addition & 0 deletions _includes/post-li.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ <h2>
<span class="post-meta">
<span class="date">
{% include date.html date=post.date %}
{% include last_modified_at.html object=post %}
</span>
</span>

Expand Down
1 change: 1 addition & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ <h1 class="post-title" itemprop="name headline">{{ page.title | escape }}</h1>
<time datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">
{% include date.html date=page.date %}
</time>
{% include last_modified_at.html object=page %}
{% if page.author %} •
<span itemprop="author" itemscope itemtype="http://schema.org/Person"><span itemprop="name">{{ page.author }}</span></span>
{% endif %}
Expand Down
17 changes: 17 additions & 0 deletions _sass/academic/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,20 @@
margin-left: 0;
list-style: none;

.last-update {
display: none;
color: $grey-color-light;
a {
color: $grey-color-light;
}
}

> li {
margin-bottom: $spacing-unit;

&:hover .last-update {
display: inline-block;
}
}

.post-link {
Expand Down Expand Up @@ -380,6 +392,11 @@
}
}

.last-update {
color: $grey-color;
a { color: inherit }
}

.post-thumbnail {
position: absolute;
z-index: -1;
Expand Down
2 changes: 1 addition & 1 deletion academic.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = "academic"
spec.version = "0.2.0"
spec.version = "0.4.0"
spec.authors = ["gaalcaras"]
spec.email = ["gaby.alcaras@gmail.com"]

Expand Down

0 comments on commit 0d21253

Please sign in to comment.