Skip to content

Commit

Permalink
Use jekyll-last-modified-at
Browse files Browse the repository at this point in the history
  • Loading branch information
znz committed Mar 19, 2018
1 parent 892b97e commit b98c4eb
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -5,6 +5,7 @@ gem 'jekyll-paginate', group: :jekyll_plugins
gem 'jekyll-compose', group: :jekyll_plugins
gem 'jekyll-minifier', group: :jekyll_plugins
gem 'jekyll-sitemap', group: :jekyll_plugins
gem 'jekyll-last-modified-at', group: :jekyll_plugins
gem 'jekyll-tagging', group: :jekyll_plugins
gem 'nokogiri'
gem 'fastimage'
5 changes: 5 additions & 0 deletions Gemfile.lock
Expand Up @@ -33,6 +33,9 @@ GEM
safe_yaml (~> 1.0)
jekyll-compose (0.7.0)
jekyll (~> 3.0)
jekyll-last-modified-at (1.0.1)
jekyll (~> 3.3)
posix-spawn (~> 0.3.9)
jekyll-minifier (0.1.5)
cssminify2 (~> 2.0)
htmlcompressor (~> 0.3)
Expand Down Expand Up @@ -60,6 +63,7 @@ GEM
nuggets (1.5.0)
pathutil (0.16.1)
forwardable-extended (~> 2.6)
posix-spawn (0.3.13)
public_suffix (3.0.2)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
Expand All @@ -82,6 +86,7 @@ DEPENDENCIES
fastimage
jekyll
jekyll-compose
jekyll-last-modified-at
jekyll-minifier
jekyll-paginate
jekyll-sitemap
Expand Down
7 changes: 7 additions & 0 deletions _config.yml
Expand Up @@ -44,10 +44,17 @@ kramdown:

plugins:
- jekyll-paginate
- jekyll-last-modified-at

permalink: /:categories/:year-:month-:day-:title.html
strict_front_matter: true

defaults:
- scope:
path: "tag/"
values:
sitemap: false

# jekyll-tagging
tag_page_layout: tag_page
tag_page_dir: tag
Expand Down
2 changes: 1 addition & 1 deletion _includes/metadata.json
Expand Up @@ -5,7 +5,7 @@
"mainEntityOfPage": "{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}",
"headline": "{% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %}",
"datePublished": "{% if page.date %}{{ page.date | date_to_xmlschema }}{% else %}{{ site.time | date_to_xmlschema }}{% endif %}",
"dateModified": "{% if page.date %}{{ page.date | date_to_xmlschema }}{% else %}{{ site.time | date_to_xmlschema }}{% endif %}",
"dateModified": "{% if page.last_modified_at %}{{ page.last_modified_at | date_to_xmlschema }}{% elsif page.date %}{{ page.date | date_to_xmlschema }}{% else %}{{ site.time | date_to_xmlschema }}{% endif %}",
"description": "{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}",
"author": {
"@type": "Person",
Expand Down
1 change: 1 addition & 0 deletions _layouts/post.html
Expand Up @@ -7,6 +7,7 @@
<h1 class="post-title">{{ page.title }}</h1>
<div>Tags: {{ page | tags }}</div>
<div>Created at: {{ page.date | date: "%Y-%m-%d %H:%M:%S" }}</div>
<div>Last modified at: {{ page.last_modified_at | date: "%Y-%m-%d %H:%M:%S" }}</div>
</div>

<section class="post-content">
Expand Down
14 changes: 14 additions & 0 deletions _plugins/skip_last_modified_at.rb
@@ -0,0 +1,14 @@
# frozen_string_literal: true

require 'jekyll-last-modified-at/determinator'

module SkipLastModifiedAt
def last_modified_at_time
return if page_path == 'index.html' # jekyll-paginate
return if %r!\Atag/! =~ page_path # jekyll-tagging
super
end
end
class Jekyll::LastModifiedAt::Determinator
prepend SkipLastModifiedAt
end

0 comments on commit b98c4eb

Please sign in to comment.