Skip to content

Commit b11ba84

Browse files
committed
Generate sitemap by plugin
1 parent 977c9e7 commit b11ba84

File tree

6 files changed

+8
-110
lines changed

6 files changed

+8
-110
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ group :jekyll_plugins do
88
gem "jekyll-redirect-from"
99
gem "jekyll-seo-tag", "~> 2.6.1"
1010
gem "jekyll-archives"
11+
gem "jekyll-sitemap"
1112
end
1213

1314
group :test do

_config.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
# jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
99
#--------------------------
10-
1110
title: Chirpy # the main title
1211

1312
tagline: A text-focused Jekyll theme. # it will display as the sub-title
@@ -42,7 +41,6 @@ social:
4241
# - https://www.linkedin.com/in/username
4342

4443
google_site_verification: google_meta_tag_verification # change to your verification string
45-
4644
#--------------------------
4745

4846

@@ -184,31 +182,15 @@ compress_html:
184182
envs: []
185183

186184
exclude:
187-
- vendor # Avoid Jekyll mistakenly read the vendor directory on Travis-CI's VM .
185+
- vendor
188186
- Gemfile.lock
189187
- Gemfile
190188
- tools
191189
- docs
192190
- README.md
193191
- LICENSE
194192

195-
sitemap_exclude: # Sitemap will exclude the following items.
196-
fuzzy:
197-
- /assets/
198-
accurate:
199-
- /norobots/
200-
- /tabs/
201-
- /categories/
202-
- /tags/
203-
- /posts/
204-
- 404.html
205-
- feed.xml
206-
- sitemap.xml
207-
- robots.txt
208-
- redirects.json
209-
210-
# see: <https://github.com/jekyll/jekyll-archives/blob/master/docs/configuration.md>
211-
jekyll-archives:
193+
jekyll-archives:
212194
enabled: [categories, tags]
213195
layouts:
214196
category: category

_includes/update-list.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
{% assign all_list = "" | split: "" %}
1212

1313
{% for post in site.posts %}
14-
{% if post.lastmod %}
14+
{% if post.last_modified_at %}
1515
{% capture elem %}
16-
{{- post.lastmod | date: "%Y%m%d%H%M%S" -}}::{{- forloop.index0 -}}
16+
{{- post.last_modified_at | date: "%Y%m%d%H%M%S" -}}::{{- forloop.index0 -}}
1717
{% endcapture %}
1818
{% assign all_list = all_list | push: elem %}
1919
{% endif %}

_layouts/post.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ <h1 data-toc-skip>{{ page.title }}</h1>
3131
</div>
3232

3333
<!-- lastmod -->
34-
{% if page.lastmod %}
34+
{% if page.last_modified_at %}
3535
<div>
3636
Updated
37-
{% include timeago.html date=page.lastmod class="lastmod" tooltip=true %}
37+
{% include timeago.html date=page.last_modified_at class="lastmod" tooltip=true %}
3838
</div>
3939
{% endif %}
4040

_plugins/posts-lastmod-hook.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
if commit_num.to_i > 1
77
lastmod_date = `git log -1 --pretty="%ad" --date=iso "#{ post.path }"`
8-
post.data['lastmod'] = lastmod_date
8+
post.data['last_modified_at'] = lastmod_date
99
end
1010

1111
end

sitemap.xml

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)