diff options
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | scripts/bupa | 8 | ||||
-rw-r--r-- | src/templates/sitemap.xml (renamed from src/sitemap.xml) | 5 |
3 files changed, 13 insertions, 4 deletions
@@ -34,10 +34,6 @@ build/resources/%: src/resources/% @install -m644 $< $@ @echo Copied $< → $@ -build/sitemap.xml: src/sitemap.xml - @install -Dm644 $< $@ - @echo Copied $< → $@ - build/pgp-key.txt: src/pgp-key.txt @install -Dm644 $< $@ @echo Copied $< → $@ diff --git a/scripts/bupa b/scripts/bupa index 1208263..e87ca4c 100755 --- a/scripts/bupa +++ b/scripts/bupa @@ -104,6 +104,8 @@ def build_journal(jinja_env): with open('build/journal.atom', 'wb') as file: file.write(atom_feed.to_string().encode('utf-8')) + make_sitemap(jinja_env, entries) + def build_page(jinja_env, template, pagename): page = parse('src/'+pagename+'.rst') page.body = reST_to_html(page.body) @@ -116,6 +118,12 @@ def write_page(page, header, filename, template, jinja_env): rendered_page = template.render(page=page, title=page.title, header=header) file.write(rendered_page.encode('utf-8')) +def make_sitemap(jinja_env, entries): + template = jinja_env.get_template('sitemap.xml') + with open('build/sitemap.xml', 'wb') as f: + rendered = template.render(entries=entries) + f.write(rendered.encode('utf-8')) + def main(): arguments = docopt.docopt(__doc__, version='bupa 0.0.1') jinja_env = Environment(loader=FileSystemLoader('src/templates')) # something something jinja2 templates diff --git a/src/sitemap.xml b/src/templates/sitemap.xml index e35ec27..d3943e4 100644 --- a/src/sitemap.xml +++ b/src/templates/sitemap.xml @@ -12,4 +12,9 @@ <url> <loc>https://theos.kyriasis.com/~kyrias/pgp-key.txt</loc> </url> +{% for entry in entries %} + <url> + <loc>https://theos.kyriasis.com/~kyrias/journal/{{ entry.page }}</loc> + </url> +{% endfor %} </urlset> |