From 3059c146482ba4fde0d1686849701934cd1d57d1 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Thu, 14 Oct 2021 06:41:18 +0000 Subject: [PATCH] Add page full of text files --- content/pages/text-files.md | 6 ++++++ content/text/test.txt | 1 + publishconf_lite.py | 10 +++++++++- themes/lite/templates/index.html | 1 + themes/lite/templates/page.html | 4 ++++ themes/lite/templates/text-files.html | 15 +++++++++++++++ 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 content/pages/text-files.md create mode 100644 content/text/test.txt create mode 100644 themes/lite/templates/page.html create mode 100644 themes/lite/templates/text-files.html diff --git a/content/pages/text-files.md b/content/pages/text-files.md new file mode 100644 index 0000000..164b48e --- /dev/null +++ b/content/pages/text-files.md @@ -0,0 +1,6 @@ +Title: Text Files +Template: text-files +Slug: x + + +Qot. diff --git a/content/text/test.txt b/content/text/test.txt new file mode 100644 index 0000000..3b18e51 --- /dev/null +++ b/content/text/test.txt @@ -0,0 +1 @@ +hello world diff --git a/publishconf_lite.py b/publishconf_lite.py index e10a5ab..1866e2b 100644 --- a/publishconf_lite.py +++ b/publishconf_lite.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals +import os AUTHOR = 'Tanner Collin' SITENAME = 'Tanner Collin' @@ -34,7 +35,7 @@ MARKDOWN = { 'output_format': 'html5', } -STATIC_PATHS = ['images', 'extra'] +STATIC_PATHS = ['images', 'extra', 'text'] EXTRA_PATH_METADATA = { #'extra/favicon.svg': {'path': 'favicon.svg'}, @@ -57,5 +58,12 @@ TAGS_SAVE_AS = '' INDEX_SAVE_AS = 'index.html' ARTICLE_URL = '{date:%d}' ARTICLE_SAVE_AS = '{date:%d}/index.html' +PAGE_URL = '{slug}' +PAGE_SAVE_AS = '{slug}/index.html' + +def list_text_files(): + return sorted(os.listdir('./content/text')) + +JINJA_GLOBALS = {'list_text_files': list_text_files} PROD = True diff --git a/themes/lite/templates/index.html b/themes/lite/templates/index.html index 495fbff..6827e84 100644 --- a/themes/lite/templates/index.html +++ b/themes/lite/templates/index.html @@ -38,4 +38,5 @@ BSc. Electrical Engineering from University of Calgary {% for article in articles_page.object_list if article.category.name == 'Writing' %} {{ article.title }} {% endfor %} +[Text Files] {% endblock %} diff --git a/themes/lite/templates/page.html b/themes/lite/templates/page.html new file mode 100644 index 0000000..94ab22b --- /dev/null +++ b/themes/lite/templates/page.html @@ -0,0 +1,4 @@ +
+{{ page.content }}
+
+ diff --git a/themes/lite/templates/text-files.html b/themes/lite/templates/text-files.html new file mode 100644 index 0000000..f5fc7bf --- /dev/null +++ b/themes/lite/templates/text-files.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} +{% block meta %} +{% endblock %} + +{% block style %} +{% endblock %} + +{% block content %} +

Text Files

+Here are some various text notes that I share with the public. +
+{% for f in list_text_files() %} +
{{ f }} +{% endfor %} +{% endblock %}