fix: generate microblog-specific feed & sitemap

This commit is contained in:
Ming Di Leom 2024-09-28 08:08:19 +00:00
parent 132f0eb30b
commit ea18a4e26f
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
4 changed files with 9 additions and 21 deletions

View File

@ -62,8 +62,8 @@ deploy:
- chmod 600 ~/.ssh/config
script:
- rsync -azvh --delete public/microblog/ host-1:/var/www/microblog/
- rsync -azvh --delete public/microblog/ host-2:/var/www/microblog/
- rsync -azvh --delete --include-from rsync-include.txt --exclude='*' public/ host-1:/var/www/
- rsync -azvh --delete --include-from rsync-include.txt --exclude='*' public/ host-2:/var/www/
rules:
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME == "microblog" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'

View File

@ -81,6 +81,10 @@ theme: chameleon
feed:
icon: "/svg/favicon.svg"
path: atom-microblog.xml
sitemap:
path: sitemap-microblog.xml
# theme config
theme_config:

3
rsync-include.txt Normal file
View File

@ -0,0 +1,3 @@
microblog
atom-microblog.xml*
sitemap-microblog.xml*

View File

@ -10,23 +10,4 @@
{% endif %}
</url>
{% endfor %}
{# home page #}
<url>
<loc>{{ config.root | fullUrlFor }}</loc>
<lastmod>{% if posts[0].updated %}{{ posts[0].updated | formatDate }}{% else %}{{ posts[0].date | formatDate }}{% endif %}</lastmod>
</url>
{# archive page #}
<url>
<loc>{{ config.archive_dir | fullUrlFor + '/' }}</loc>
<lastmod>{% if posts[0].updated %}{{ posts[0].updated | formatDate }}{% else %}{{ posts[0].date | formatDate }}{% endif %}</lastmod>
</url>
{% for tag in tags %}
<url>
<loc>{{ tag.permalink }}</loc>
<lastmod>{% if tag.posts.first().updated %}{{ tag.posts.first().updated | formatDate }}{% else %}{{ tag.posts.first().date | formatDate }}{% endif %}</lastmod>
</url>
{% endfor %}
</urlset>