select a template using yaml
This commit is contained in:
5
app.py
5
app.py
@ -102,7 +102,10 @@ env.filters["prettydate"] = prettydate
|
|||||||
# translate a single file into HTML
|
# translate a single file into HTML
|
||||||
def render_single_file(page, path, dist, name = False):
|
def render_single_file(page, path, dist, name = False):
|
||||||
name = Path(path).stem
|
name = Path(path).stem
|
||||||
template = env.select_template([f"{name}.jinja", "index.jinja"])
|
template_name = name
|
||||||
|
if "template" in page:
|
||||||
|
template_name = page["template"]
|
||||||
|
template = env.select_template([f"{template_name}.jinja", "index.jinja"])
|
||||||
html = template.render(documents=documents, page=page, name=name)
|
html = template.render(documents=documents, page=page, name=name)
|
||||||
|
|
||||||
if not os.path.exists(dist):
|
if not os.path.exists(dist):
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: A newsletter for december
|
title: A newsletter for december
|
||||||
published: false
|
published: false
|
||||||
|
template: newsletter
|
||||||
---
|
---
|
||||||
|
|
||||||
# Klankbord Digest January 2025
|
# Klankbord Digest January 2025
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
---
|
||||||
|
title: A title for my fun newsletter
|
||||||
|
published: false
|
||||||
|
template: newsletter
|
||||||
|
---
|
||||||
|
|
||||||
I'd like to begin this month's Klankbord Digest with a server update.
|
I'd like to begin this month's Klankbord Digest with a server update.
|
||||||
Let's backtrack a bit to understand how the current circumstances
|
Let's backtrack a bit to understand how the current circumstances
|
||||||
arose. The server began as a prototype on a Mac Pro Trash Bin computer
|
arose. The server began as a prototype on a Mac Pro Trash Bin computer
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
margin: 2rem auto;
|
margin: 2rem auto;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
|
padding: 12px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
{% block title %}
|
{% block title %}
|
||||||
@ -38,7 +39,7 @@
|
|||||||
</head>
|
</head>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
settings for newssletter only {{ name }}
|
|
||||||
<main>
|
<main>
|
||||||
<section>
|
<section>
|
||||||
<article>
|
<article>
|
Reference in New Issue
Block a user