aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.idea/php.xml4
-rw-r--r--_posts/article.md26
-rw-r--r--_posts/assets/stuff.jpgbin13178 -> 0 bytes
-rw-r--r--_site/.htaccess7
-rw-r--r--_site/about/index.php30
-rw-r--r--_site/articles/index.php16
-rw-r--r--_site/authors/antoine62.jpgbin0 -> 29725 bytes
-rw-r--r--_site/authors/minteck.jpgbin0 -> 65748 bytes
-rw-r--r--_site/errs/403.php10
-rw-r--r--_site/errs/404.php10
-rw-r--r--_site/errs/500.php10
-rw-r--r--_site/home/index.php5
-rw-r--r--_site/includes/articles/getlist.php9
-rw-r--r--_site/includes/dom/footer.php14
-rw-r--r--_site/includes/dom/header.php10
-rw-r--r--_site/rewrites/article.php6
17 files changed, 127 insertions, 31 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ca283dd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+_posts/* \ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
new file mode 100644
index 0000000..7341688
--- /dev/null
+++ b/.idea/php.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="PhpProjectSharedConfiguration" php_language_level="7.4" />
+</project> \ No newline at end of file
diff --git a/_posts/article.md b/_posts/article.md
deleted file mode 100644
index 2c76fba..0000000
--- a/_posts/article.md
+++ /dev/null
@@ -1,26 +0,0 @@
----
-date: 2020-01-05
-title: Hello there
-author: Minteck|antoine62
-cover: /assets/stuff.jpg
----
-
-# Content of the post
-This is a test post!
-
-Can you believe this was Markdown before?
-
-| table | test
-| --- | ---
-| let's | do |
-| some | stuff |
-
-Some `code` (well, that formatting is pretty useless since everything is monospace font)
-
-```javascript
-function test() {
- console.log("Some code block!");
-}
-```
-
-![Test image](/assets/stuff.jpg) \ No newline at end of file
diff --git a/_posts/assets/stuff.jpg b/_posts/assets/stuff.jpg
deleted file mode 100644
index 650263a..0000000
--- a/_posts/assets/stuff.jpg
+++ /dev/null
Binary files differ
diff --git a/_site/.htaccess b/_site/.htaccess
index 9fd4c96..034d457 100644
--- a/_site/.htaccess
+++ b/_site/.htaccess
@@ -1,4 +1,7 @@
RewriteEngine on
RewriteBase /
-RewriteRule ^/?article/([a-zA-Z0-9_]+)$ /rewrites/article.php?i=$1 [L]
-RewriteRule ^/?assets/([a-zA-Z0-9_./]+)$ /rewrites/assets.php?i=$1 [L] \ No newline at end of file
+RewriteRule ^/?article/([a-zA-Z0-9_\-]+)$ /rewrites/article.php?i=$1 [L]
+RewriteRule ^/?assets/([a-zA-Z0-9_\-./]+)$ /rewrites/assets.php?i=$1 [L]
+
+ErrorDocument 404 /errs/404.php
+ErrorDocument 403 /errs/403.php \ No newline at end of file
diff --git a/_site/about/index.php b/_site/about/index.php
new file mode 100644
index 0000000..57afa94
--- /dev/null
+++ b/_site/about/index.php
@@ -0,0 +1,30 @@
+<?php $_TITLE = "About Blogchain"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/header.php"; ?>
+
+<div class="container" style="margin-top:30px;text-align: center;">
+ <h2>What's that? Who's behind it?</h2>
+ <p>Let us a moment to introduce ourselves.</p>
+</div>
+<div class="container">
+ <p>Blogchain is a tech-centric blog written by two people on their free time. Whether it is the new Windows update or the latest iPhone, the Blogchain writers will always find a topic to talk about.</p>
+
+ <p>Blogchain is proudly powered by open-source software! Namely:
+ <ul>
+ <li><a href="https://github.com/erusev/parsedown" target="_blank">Parsedown</a></li>
+ <li><a href="https://php.net" target="_blank">PHP</a></li>
+ <li><a href="https://httpd.apache.org" target="_blank">The Apache HTTP Server</a></li>
+ <li><a href="https://kernel.org" target="_blank">The Linux kernel</a></li>
+ <li><a href="https://www.openssh.com/" target="_blank">OpenSSH</a></li>
+ <li><a href="https://git-scm.org" target="_blank">The Git version control system</a></li>
+ <li>and much more...</li>
+ </ul></p>
+
+ <p>Last but not least, Blogchain wouldn't be so easy to develop without <a href="https://jetbrains.com" target="_blank">JetBrains software</a>. Huge thanks to them for giving me (Minteck) a free license to help me develop my FLOSS software faster than ever!</p>
+
+ <h2>Who is behind this blog?</h2>
+ <div class="list-group no-link">
+ <li class="list-group-item"><img src="/authors/antoine62.jpg" width="32px" style="vertical-align: middle;"> <b>antoine62</b>g writer, correcter, UI/UX tester · Contact him on <a href="https://matrix.to/#/@antoine62:halogen.city" style="text-decoration: underline;">Matrix</a></li>
+ <li class="list-group-item"><img src="/authors/minteck.jpg" width="32px" style="vertical-align: middle;"> <b>Minteck</b> writer, developer, UI/UX designer · Contact him on <a href="https://matrix.to/#/@minteck:kde.org" style="text-decoration: underline;">Matrix</a> and <a href="https://twitter.com/_Minteck" style="text-decoration: underline;">Twitter</a></li>
+ </div>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/footer.php"; ?> \ No newline at end of file
diff --git a/_site/articles/index.php b/_site/articles/index.php
new file mode 100644
index 0000000..b694a15
--- /dev/null
+++ b/_site/articles/index.php
@@ -0,0 +1,16 @@
+<?php $_TITLE = "Articles Index"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/header.php"; ?>
+
+<div class="container" style="margin-top:30px;text-align: center;">
+ <h2>Here be dragons!</h2>
+ <p>This is the complete list of all the posts that were on Blogchain one day. Yep, they are all here!</p>
+</div>
+<?php $list = getArticlesList() ?>
+<div class="container">
+ <div class="list-group">
+ <?php $index = 0;foreach ($list as $id => $item): ?>
+ <a href="/article/<?= $id ?>" class="list-group-item list-group-item-action"><?= $item["title"] ?></a>
+ <?php $index++;endforeach; ?>
+ </div>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/footer.php"; ?> \ No newline at end of file
diff --git a/_site/authors/antoine62.jpg b/_site/authors/antoine62.jpg
new file mode 100644
index 0000000..b63b23d
--- /dev/null
+++ b/_site/authors/antoine62.jpg
Binary files differ
diff --git a/_site/authors/minteck.jpg b/_site/authors/minteck.jpg
new file mode 100644
index 0000000..3c6236c
--- /dev/null
+++ b/_site/authors/minteck.jpg
Binary files differ
diff --git a/_site/errs/403.php b/_site/errs/403.php
new file mode 100644
index 0000000..03fd907
--- /dev/null
+++ b/_site/errs/403.php
@@ -0,0 +1,10 @@
+<?php $_TITLE = "Error 403"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/header.php"; ?>
+
+<div class="container" style="margin-top:30px;text-align: center;">
+ <h1># 403_</h1>
+ <h4 style="margin-bottom:20px;">Feeling curious, huh?</h4>
+ <p>You tried to access some <i>secret folder</i> that only the server administrators can access; in other words: you can't access this right now because we don't want you to.</p>
+ <p>You probably want to <a href="/" style="text-decoration: underline;">go back home</a>.</p>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/footer.php"; ?> \ No newline at end of file
diff --git a/_site/errs/404.php b/_site/errs/404.php
new file mode 100644
index 0000000..d2ef0f3
--- /dev/null
+++ b/_site/errs/404.php
@@ -0,0 +1,10 @@
+<?php $_TITLE = "Error 404"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/header.php"; ?>
+
+<div class="container" style="margin-top:30px;text-align: center;">
+ <h1># 404_</h1>
+ <h4 style="margin-bottom:20px;">You surely know what this means.</h4>
+ <p>Welp, we can't find what you are looking for right now. If you clicked on a link, the relevant page may have been moved, deleted or something like that.</p>
+ <p>You probably want to <a href="/" style="text-decoration: underline;">go back home</a>.</p>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/footer.php"; ?> \ No newline at end of file
diff --git a/_site/errs/500.php b/_site/errs/500.php
new file mode 100644
index 0000000..b7421a0
--- /dev/null
+++ b/_site/errs/500.php
@@ -0,0 +1,10 @@
+<?php $_TITLE = "Error 403"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/header.php"; ?>
+
+<div class="container" style="margin-top:30px;text-align: center;">
+ <h1># 500_</h1>
+ <h4 style="margin-bottom:20px;">Did I miss something?</h4>
+ <p>Something's really wrong with the server and we can't get you to that thing you wanted right now. Perhaps you could try that later</p>
+ <p>You probably want to <a href="/" style="text-decoration: underline;">go back home</a>.</p>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/footer.php"; ?> \ No newline at end of file
diff --git a/_site/home/index.php b/_site/home/index.php
index c8a64db..2425013 100644
--- a/_site/home/index.php
+++ b/_site/home/index.php
@@ -30,11 +30,14 @@
<h3 style="margin-top:20px;">Also check out our older articles:</h3>
<div class="list-group">
<?php $index = 0;foreach ($list as $id => $item): ?>
- <?php if ($index > 3): ?>
+ <?php if ($index >= 3 && $index < 100): ?>
<a href="/article/<?= $id ?>" class="list-group-item list-group-item-action"><?= $item["title"] ?></a>
<?php endif; ?>
<?php $index++;endforeach; ?>
</div>
+ <?php if (count($list) > 100): ?>
+ <p>Wait! There's more! Our older articles aren't listed here to save you some bytes of data. You can get to the complete list <a href="/articles" style="text-decoration: underline;">here</a>.</p>
+ <?php endif; ?>
<?php endif; ?>
</div>
diff --git a/_site/includes/articles/getlist.php b/_site/includes/articles/getlist.php
index 5f55574..e3947f2 100644
--- a/_site/includes/articles/getlist.php
+++ b/_site/includes/articles/getlist.php
@@ -1,7 +1,11 @@
<?php
+$listGetTimeout = 0;
+
function getArticlesList() {
+ $listGetStart = new DateTime("now");
global $Parsedown;
+ global $listGetTimeout;
$list = [];
$files = scandir($_SERVER['DOCUMENT_ROOT'] . "/../_posts");
@@ -82,5 +86,10 @@ function getArticlesList() {
}
}
+ $listGetEnd = new DateTime("now");
+
+ $listGetTimeoutA = $listGetStart->diff($listGetEnd);
+ $listGetTimeout = $listGetTimeoutA->f;
+
return $list;
} \ No newline at end of file
diff --git a/_site/includes/dom/footer.php b/_site/includes/dom/footer.php
index 31b6cb8..4832ed2 100644
--- a/_site/includes/dom/footer.php
+++ b/_site/includes/dom/footer.php
@@ -1,7 +1,19 @@
<hr>
<div class="container">
- <p># blogchain <a href="https://twitter.com/_Minteck" target="_blank">--twitter</a> <a href="https://github.com/Minteck/Blogchain-Software" target="_blank">--github</a>gi_</p>
+ <p># blogchain <a href="https://twitter.com/_Minteck" target="_blank">--support</a> <a href="https://github.com/Minteck/Blogchain-Software" target="_blank">--code</a> <a href="/about">--version</a>_<br>
+ <span style="color:black !important;">
+ <?php
+
+ /** @var float $listGetTimeout */
+ if ($listGetTimeout !== 0) {
+ echo("Articles list loading took " . round($listGetTimeout*1000, 4) . " ms");
+ } else {
+ echo("No articles list loading");
+ }
+
+ ?>
+ </span></p>
</div>
</body>
diff --git a/_site/includes/dom/header.php b/_site/includes/dom/header.php
index 7398567..079adb5 100644
--- a/_site/includes/dom/header.php
+++ b/_site/includes/dom/header.php
@@ -1,5 +1,6 @@
<?php
+$listGetTimeout = 0;
ob_start();
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/markdown.php";
@@ -238,7 +239,7 @@ register_shutdown_function("customShutdown");
border: 1px solid #00ff00;
}
- .list-group-item:hover {
+ .list-group:not(.no-link) .list-group-item:hover {
background: #00ff00;
color: black !important;
}
@@ -289,6 +290,13 @@ register_shutdown_function("customShutdown");
box-shadow: none;
}
+ #article-cover {
+ width: 100%;
+ height: 50vh;
+ background-size: cover;
+ background-position: center;
+ }
+
</style>
</head>
<body>
diff --git a/_site/rewrites/article.php b/_site/rewrites/article.php
index eb98798..613121b 100644
--- a/_site/rewrites/article.php
+++ b/_site/rewrites/article.php
@@ -39,7 +39,13 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/dom/header.php";
?>, by <?= implode(" and ", $item["author"]) ?></p>
</div>
</div>
+</div>
+
+<?php if (!is_null($item["cover"])): ?>
+<header id="article-cover" style="background-image:url('<?= $item["cover"] ?>')"></header>
+<?php endif; ?>
+<div class="container" style="margin-top:15px;">
<article>
<?= $item["content"]["full"] ?>
</article>