add post title and date
Some checks are pending
ci/woodpecker/push/publish Pipeline is pending

This commit is contained in:
Mylloon 2023-04-25 03:29:55 +02:00
parent c03be32b94
commit 2bec742bb2
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
4 changed files with 35 additions and 19 deletions

View file

@ -36,6 +36,16 @@ html {
background-color: var(--bg);
}
/* Post's title */
header > h1 {
font-size: 2.5rem;
}
/* Date's title */
header > p {
font-style: italic;
}
::selection {
color: rgb(255, 255, 255);
background: var(--selection);

17
templates/blog/date.html Normal file
View file

@ -0,0 +1,17 @@
<span>
{{#date}}
<script>
{
const date = new Date(+"{{year}}", +"{{month}}", +"{{day}}");
document.currentScript.outerHTML = date.toLocaleDateString(
navigator.language || navigator.userLanguage,
{
year: "numeric",
month: "long",
day: "numeric",
}
);
}
</script>
{{/date}}
</span>

View file

@ -15,23 +15,7 @@
<ul>
{{#posts}}
<li onclick="location.href='/blog/{{url}}';">
<span>
{{#date}}
<script>
{
const date = new Date(+"{{year}}", +"{{month}}", +"{{day}}");
document.currentScript.outerHTML = date.toLocaleDateString(
navigator.language || navigator.userLanguage,
{
year: "numeric",
month: "long",
day: "numeric",
}
);
}
</script>
{{/date}}
</span>
{{>blog/date.html}}
<div class="content">
<h2>{{title}}</h2>
{{#desc}}

View file

@ -6,10 +6,15 @@
{{#data}} {{#post}} {{#metadata}}
{{#math}}{{>libs/katex_head.html}}{{/math}}
{{#syntax_highlight}}{{>libs/hljs_head.html}}{{/syntax_highlight}}
{{/metadata}} {{/post}}
</head>
<body class="index">
<header></header>
<header>
{{#info}}
<h1>{{title}}</h1>
{{#date}}
<p>{{>blog/date.html}}</p>
{{/date}} {{/info}} {{/metadata}} {{/post}}
</header>
<main>
{{^post}}
<p>This post doesn't exist... sorry</p>