Skip to content

Commit 35a38bf

Browse files
committed
Include subsites in sitemap.xml
1 parent 319f020 commit 35a38bf

6 files changed

Lines changed: 57 additions & 2 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Ignore docs files
22
_gh_pages
33
_site
4-
.ruby-version
54

65
# Numerous always-ignore extensions
76
*.diff

.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.3

Gemfile.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ PLATFORMS
270270
x64-mingw32
271271
x64-unknown
272272
x86_64-darwin-20
273+
x86_64-darwin-21
273274
x86_64-linux
274275

275276
DEPENDENCIES

_config.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ exclude:
8080
# Plugins (previously gems:)
8181
plugins:
8282
- jekyll-paginate
83-
- jekyll-sitemap
8483
- jekyll-gist
8584
- jekyll-feed
8685
- jemoji

_data/sitemap.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
subsites:
2+
- jekyll-redirect-html
3+
- jekyll-related-posts
4+
- jsonpath-cli
5+
- raml-editor
6+
- shlog
7+
- t800-rifle
8+
- t800-eyes
9+
- t800-hk

sitemap.xml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
layout: compress
3+
---
4+
<?xml version="1.0" encoding="UTF-8"?>
5+
{% if page.xsl %}
6+
<?xml-stylesheet type="text/xsl" href="{{ "/sitemap.xsl" | absolute_url }}"?>
7+
{% endif %}
8+
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
9+
{% assign collections = site.collections | where_exp:'collection','collection.output != false' %}
10+
{% for collection in collections %}
11+
{% assign docs = collection.docs | where_exp:'doc','doc.sitemap != false' %}
12+
{% for doc in docs %}
13+
<url>
14+
<loc>{{ doc.url | replace:'/index.html','/' | absolute_url | xml_escape }}</loc>
15+
{% if doc.last_modified_at or doc.date %}
16+
<lastmod>{{ doc.last_modified_at | default: doc.date | date_to_xmlschema }}</lastmod>
17+
{% endif %}
18+
</url>
19+
{% endfor %}
20+
{% endfor %}
21+
22+
{% assign pages = site.html_pages | where_exp:'doc','doc.sitemap != false' | where_exp:'doc','doc.url != "/404.html"' %}
23+
{% for page in pages %}
24+
<url>
25+
<loc>{{ page.url | replace:'/index.html','/' | absolute_url | xml_escape }}</loc>
26+
{% if page.last_modified_at %}
27+
<lastmod>{{ page.last_modified_at | date_to_xmlschema }}</lastmod>
28+
{% endif %}
29+
</url>
30+
{% endfor %}
31+
32+
{% assign static_files = page.static_files | where_exp:'page','page.sitemap != false' | where_exp:'page','page.name != "404.html"' %}
33+
{% for file in static_files %}
34+
<url>
35+
<loc>{{ file.path | replace:'/index.html','/' | absolute_url | xml_escape }}</loc>
36+
<lastmod>{{ file.modified_time | date_to_xmlschema }}</lastmod>
37+
</url>
38+
{% endfor %}
39+
40+
{% for subsite in site.data.sitemap.subsites %}
41+
<url>
42+
<loc>{{ site.url | absolute_url | xml_escape }}/{{ subsite | xml_escape}}/</loc>
43+
</url>
44+
{% endfor %}
45+
46+
</urlset>

0 commit comments

Comments
 (0)