{% capture cache %} {% comment %} # ----------------------------------------------------------------------------- # ~/_data/templates/sitemap.xml # Liquid template to generate the sitemap XML entries # # Product/Info: # https://jekyll.one # # Copyright (C) 2022 Juergen Adams # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE # ----------------------------------------------------------------------------- # Test data: # liquid_var: {{ liquid_var | debug }} # ----------------------------------------------------------------------------- {% endcomment %} {% comment %} main -------------------------------------------------------------------------------- {% endcomment %} {% if page.xsl %} {% endif %} {% assign collections = site.collections | where_exp:'collection','collection.output != false' %} {% for collection in collections %} {% assign docs = collection.docs | where_exp:'doc','doc.sitemap != false' %} {% for doc in docs %} {{ doc.url | replace:'/index.html','/' | absolute_url | xml_escape }} {% if doc.last_modified_at or doc.date %} {{ doc.last_modified_at | default: doc.date | date_to_xmlschema }} {% endif %} {% endfor %} {% endfor %} {% assign pages = site.html_pages | where_exp:'doc','doc.sitemap != false' | where_exp:'doc','doc.url != "/404.html"' %} {% for page in pages %} {{ page.url | replace:'/index.html','/' | absolute_url | xml_escape }} {% if page.last_modified_at %} {{ page.last_modified_at | date_to_xmlschema }} {% endif %} {% endfor %} {% assign static_files = page.static_files | where_exp:'page','page.sitemap != false' | where_exp:'page','page.name != "404.html"' %} {% for file in static_files %} {{ file.path | replace:'/index.html','/' | absolute_url | xml_escape }} {{ file.modified_time | date_to_xmlschema }} {% endfor %} {% endcapture %} {% comment %} POST processing of the generated feed XML file|s -------------------------------------------------------------------------------- {% endcomment %} {{ cache }}