Add support for articles

This commit is contained in:
Reimar 2023-12-31 12:08:15 +01:00
parent a0d2e194ca
commit 81f1819d3a
Signed by: Reimar
GPG Key ID: 93549FA07F0AE268
4 changed files with 74 additions and 4 deletions

40
articles/index.php Normal file
View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<?php require "../inc/head.inc" ?>
</head>
<body>
<?php require "../inc/nav.inc" ?>
<div id="main-and-sidebar" dir="rtl" class="inline-block">
<div id="main-wrapper" class="inline-block">
<div id="main" class="inline-block">
<main>
<div class="section container">
<h1>Articles</h1>
This is a collection of articles written by me and my friends
</div>
<div class="section container">
<?php $articles = json_decode(file_get_contents("../data/articles.json")) ?>
<?php foreach ($articles as $i=>$article): ?>
<a class="reverse-link" href="/articles/<?= $article->slug ?>">
<h2 style="margin: 0"><?= $article->title ?></h2>
</a>
by <?= $article->author ?> &bull; <i>written <?= $article->created ?></i>
<?php if ($i != count($articles) - 1): ?><hr><?php endif ?>
<?php endforeach ?>
</div>
</main>
</div>
</div><!--
--><?php require "../inc/sidebar.inc" ?>
</div>
<?php require "../inc/background.inc" ?>
</body>
</html>

View File

@ -27,12 +27,15 @@ body {
-webkit-transition: all 0.2s linear, width 0s; -webkit-transition: all 0.2s linear, width 0s;
-moz-transition: all 0.2s linear, width 0s; -moz-transition: all 0.2s linear, width 0s;
} }
a {
outline: none;
}
a:hover { a:hover {
text-decoration: none; text-decoration: none;
} }
a.reverse-link {
text-decoration: none;
}
a.reverse-link:hover {
text-decoration: underline;
}
.loading, .loading * { .loading, .loading * {
cursor: wait !important; cursor: wait !important;
} }
@ -265,3 +268,14 @@ object {
img { img {
border: none; /* Fix ico images on internet explorer */ border: none; /* Fix ico images on internet explorer */
} }
@media print {
#grass, .light.tree, .dark.tree {
display: none !important;
}
.container {
background-color: red !important;
}
}

15
data/articles.json Normal file
View File

@ -0,0 +1,15 @@
[
{
"author": "Reimar",
"title": "Test",
"slug": "test",
"created": "2022-08-15"
},
{
"author": "Reimar",
"title": "Test",
"slug": "test",
"created": "2022-08-15"
}
]

View File

@ -4,7 +4,8 @@
$links = [ $links = [
["/", "Home"], ["/", "Home"],
["/about", "About"] ["/articles", "Articles"],
["/about", "About"],
]; ];
$path = parse_url("http://test" . $_SERVER["REQUEST_URI"])["path"]; $path = parse_url("http://test" . $_SERVER["REQUEST_URI"])["path"];