blog

git clone https://git.ce9e.org/blog.git

commit
3a0d688c61bb4655dfc5cbe4359d78cf8df5a7aa
parent
33a200a7db70a94387b3dfa3372fdc7f7f006b37
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-11-03 09:39
use pandoc template

Diffstat

M Makefile 8 ++------
M _templates/base.html 34 +++++++++++++++++++---------------
D _templates/blog.html 11 -----------
M _templates/feed.xml 16 ++++++++--------

4 files changed, 29 insertions, 40 deletions


diff --git a/Makefile b/Makefile

@@ -19,12 +19,8 @@ build/%.md: _content/%.md _content/%.yml
   19    19 	@echo >> $@
   20    20 	cat $< >> $@
   21    21 
   22    -1 build/%.html: _content/%.html _content/%.yml _templates/*.html build.py
   23    -1 	@mkdir -p $$(dirname $@)
   24    -1 	python build.py _templates/base.html $< _content/$*.yml > $@
   25    -1 
   26    -1 _content/%.html: _content/%.md
   27    -1 	pandoc $< -o $@
   -1    22 build/%.html: build/%.md _templates/base.html
   -1    23 	pandoc --template _templates/base.html $< -o $@
   28    24 	sed -i 's/<tr class="header">/<tr>/g' $@
   29    25 
   30    26 build/%.png: _content/%.png

diff --git a/_templates/base.html b/_templates/base.html

@@ -6,7 +6,7 @@
    6     6 	<meta name="viewport" content="width=device-width, initial-scale=1">
    7     7 	<meta name="referrer" content="strict-origin-when-cross-origin">
    8     8 	<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
    9    -1 	<title>Ξ{{#title}} - {{.}}{{/title}}</title>
   -1     9 	<title>Ξ${if(title)} - ${title}${endif}</title>
   10    10 	<link rel="stylesheet" type="text/css" href="/static/style.css">
   11    11 	<link rel="alternate" type="application/atom+xml" href="/feed.xml">
   12    12 </head>
@@ -27,25 +27,29 @@
   27    27 	</header>
   28    28 
   29    29 	<main class="l-main">
   30    -1 		{{#title}}<h1>{{.}}</h1>{{/title}}
   31    -1 		{{#date}}
   -1    30 		${if(title)}<h1>${title}</h1>${endif}
   -1    31 		${if(date)}
   32    32 			<div class="post__meta">
   33    -1 				Published on {{.}}
   34    -1 				{{#tags}}
   35    -1 					<a href="/#{{.}}" class="tag">{{.}}</a>
   36    -1 				{{/tags}}
   -1    33 				Published on ${date}
   -1    34 				${for(tags)}
   -1    35 					<a href="/#${it}" class="tag">${it}</a>
   -1    36 				${endfor}
   37    37 			</div>
   38    -1 		{{/date}}
   -1    38 		${endif}
   39    39 
   40    -1 		{{{body}}}
   -1    40 		${body}
   41    41 
   42    -1 		{{#player}}
   43    -1 			{{> _templates/player.html}}
   44    -1 		{{/player}}
   -1    42 		${if(blog)}
   -1    43 			<ul class="blog">
   -1    44 				${for(blog.posts)}
   -1    45 					<li class="blog__post" data-tags="${for(it.tags)}${it}${sep} ${endfor}">
   -1    46 						<a href="${it.url}">${blog.posts.title}</a>
   -1    47 					</li>
   -1    48 				${endfor}
   -1    49 			</ul>
   45    50 
   46    -1 		{{#blog}}
   47    -1 			{{> _templates/blog.html}}
   48    -1 		{{/blog}}
   -1    51 			<script src="/static/blogsearch.js" type="module"></script>
   -1    52 		${endif}
   49    53 	</main>
   50    54 </body>
   51    55 </html>

diff --git a/_templates/blog.html b/_templates/blog.html

@@ -1,11 +0,0 @@
    1    -1 <ul class="blog">
    2    -1 	{{#posts}}
    3    -1 		<li class="blog__post" data-tags="{{#tags}}{{.}} {{/tags}}">
    4    -1 			<a href="{{url}}">
    5    -1 				{{title}}
    6    -1 			</a>
    7    -1 		</li>
    8    -1 	{{/posts}}
    9    -1 </ul>
   10    -1 
   11    -1 <script src="/static/blogsearch.js" type="module"></script>

diff --git a/_templates/feed.xml b/_templates/feed.xml

@@ -7,14 +7,14 @@
    7     7 	<id>https://blog.ce9e.org/</id>
    8     8 	<link href="https://blog.ce9e.org/" rel="self" />
    9     9 
   10    -1 	{{#blog}}
   11    -1 		{{#posts}}
   -1    10 	${if(blog)}
   -1    11 		${for(posts)}
   12    12 			<entry>
   13    -1 				<title>{{title}}</title>
   14    -1 				<link href="https://blog.ce9e.org{{url}}"/>
   15    -1 				<id>https://blog.ce9e.org{{url}}</id>
   16    -1 				<updated>{{date}}T00:00:00Z</updated>
   -1    13 				<title>${it.title}</title>
   -1    14 				<link href="https://blog.ce9e.org${it.url}"/>
   -1    15 				<id>https://blog.ce9e.org${it.url}</id>
   -1    16 				<updated>${it.date}T00:00:00Z</updated>
   17    17 			</entry>
   18    -1 		{{/posts}}
   19    -1 	{{/blog}}
   -1    18 		${endfor}
   -1    19 	${endif}
   20    20 </feed>