How to make a Pelican site map

How to make a sitemap for your website in Pelican.

First, prepare a jinja template for your site map.

sitemap.html

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

{% for article in articles %}
  <url>
    <loc>{{ SITEURL }}/{{ article.url }}</loc>
    <priority>0.8</priority>
  </url>

  {% for translation in article.translations %}
  <url>
    <loc>{{ SITEURL }}/{{ translation.url }}</loc>
    <priority>0.8</priority>
  </url>
  {% endfor %}
{% endfor %}

{% for page in pages %}
  <url>
    <loc>{{ SITEURL }}/{{ page.url }}</loc>
    <priority>1.0</priority>
  </url>

  {% for translation in page.translations %}
  <url>
    <loc>{{ SITEURL }}/{{ translation.url }}</loc>
    <priority>1.0</priority>
  </url>
  {% endfor %}
{% endfor %}

</urlset>

Place the template in the templates directory of your theme, just like any other HTML template.

Then add the following settings to your config file:

DIRECT_TEMPLATES = ('index', 'tags', 'categories', 'archives', 'sitemap')

If you generate HTML after the above settings, sitemap.The xml will be generated.


Recommended Posts

How to make a Pelican site map
How to make a Japanese-English translation
How to make a crawler --Advanced
How to make a recursive function
How to make a deadman's switch
[Blender] How to make a Blender plugin
How to make a crawler --Basic
[Python] How to make a class iterable
How to make a dialogue system dedicated to beginners
How to make a dictionary with a hierarchical structure.
How to make a QGIS plugin (package generation)
I read "How to make a hacking lab"
How to call a function
How to hack a terminal
How to make a Python package using VS Code
How to install Pelican blog
How to make a Cisco Webex Teams BOT with Flask
[Python] How to make a list of character strings character by character
How to make a multiplayer online action game on Slack
How to make a hacking lab-Kali Linux (2020.1) VirtualBox 64-bit Part 2-
How to make a hacking lab-Kali Linux (2020.1) VirtualBox 64-bit edition-
How to make a Python package (written for an intern)
How to make a simple Flappy Bird game with pygame
How to write a Python class
[Rails] How to display Google Map
How to put a symbolic link
How to create a Conda package
How to create a virtual bridge
How to create a Dockerfile (basic)
[Blender] How to make Blender scripts multilingual
How to delete a Docker container
How to create a config file
How to make a string into an array or an array into a string in Python
How to make a command to read the configuration file with pyramid
How to make a surveillance camera (Security Camera) with Opencv and Python
[C language] How to create, avoid, and make a zombie process
Spigot (Paper) Introduction to how to make a plug-in for 2020 # 01 (Environment construction)
Slack --APIGateway --Lambda (Python) --How to make a RedShift interactive app
How to make a unit test Part.1 Design pattern for introduction
How to make your own domain site with heroku (free plan)
[Python] How to make a matrix of repeating patterns (repmat / tile)
How to make Word Cloud characters monochromatic
How to split and save a DataFrame
How to build a sphinx translation environment
How to create a git clone folder
How to add a package with PyCharm
How to draw a graph using Matplotlib
Try to make a kernel of Jupyter
[Colab] How to copy a huge dataset
[Python] How to invert a character string
How to install a package using a repository
[Ubuntu] How to execute a shell script
[Cocos2d-x] How to make Script Binding (Part 2)
Let's make a multilingual site using flask-babel
How to make multi-boot USB (Windows 10 compatible)
How to create a repository from media
I tried to make a Web API
To make a dict type property read-only
How to choose a Seaborn color palette
How to test on a Django-authenticated page
How to use Map in Android ViewPager