mirror of https://github.com/tildeclub/site.git
Merge pull request #68 from litemotiv/wiki_tweaks
Add order to wiki categories
This commit is contained in:
commit
1184c77a1f
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title><?=isset($title) ? $title : "Welcome to ~tilde.club~"?></title>
|
<title><?=isset($title) ? $title : "Welcome to ~tilde.club~"?></title>
|
||||||
<link rel="icon" type="image/png" href="favicon.png">
|
<link rel="icon" type="image/png" href="https://tilde.club/favicon.png">
|
||||||
|
|
||||||
<!-- Preload CSS and image resources -->
|
<!-- Preload CSS and image resources -->
|
||||||
<link rel="preload" href="/style.css" as="style">
|
<link rel="preload" href="/style.css" as="style">
|
||||||
|
|
|
@ -2,50 +2,59 @@
|
||||||
$title = "tilde.club wiki";
|
$title = "tilde.club wiki";
|
||||||
include __DIR__."/../header.php";
|
include __DIR__."/../header.php";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<h1 id="fancyboi">the tilde.club wiki</h1>
|
<h1 id="fancyboi">the tilde.club wiki</h1>
|
||||||
|
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
<p>Here's the articles on our wiki:</p>
|
||||||
<p>here's the articles on our wiki:</p>
|
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php
|
||||||
|
// category order
|
||||||
|
$order = ['tilde.club', 'tutorials', 'software', 'links'];
|
||||||
|
|
||||||
$category_to_articles = [];
|
$category_to_articles = [];
|
||||||
foreach (glob("source/*.md") as $file) {
|
|
||||||
|
// get articles
|
||||||
|
foreach (glob("source/*.md") as $file)
|
||||||
|
{
|
||||||
$article = basename($file, ".md");
|
$article = basename($file, ".md");
|
||||||
$title = preg_match("/title: (.*)/i", file_get_contents($file), $matches) ? $matches[1] : $article;
|
$title = preg_match("/title: (.*)/i", file_get_contents($file), $matches) ? $matches[1] : $article;
|
||||||
|
$title = ucfirst($title);
|
||||||
$category = preg_match("/category: (.*)/i", file_get_contents($file), $matches) ? $matches[1] : 'default';
|
$category = preg_match("/category: (.*)/i", file_get_contents($file), $matches) ? $matches[1] : 'default';
|
||||||
if (array_key_exists($category, $category_to_articles)) {
|
|
||||||
|
if (array_key_exists($category, $category_to_articles))
|
||||||
array_push($category_to_articles[$category], [$article, $title]);
|
array_push($category_to_articles[$category], [$article, $title]);
|
||||||
} else {
|
else
|
||||||
$category_to_articles[$category] = [[$article, $title]];
|
$category_to_articles[$category] = [[$article, $title]];
|
||||||
}
|
|
||||||
ksort($category_to_articles);
|
ksort($category_to_articles);
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
<?php foreach ($category_to_articles as $category => $articles) { ?>
|
foreach ($order as $category)
|
||||||
<li><?=$category?></li>
|
{
|
||||||
<ul>
|
echo '<li>'.ucwords($category).'</li>';
|
||||||
<?php
|
echo '<ul>';
|
||||||
|
|
||||||
$article_titles = [];
|
$article_titles = [];
|
||||||
$article_names = [];
|
$article_names = [];
|
||||||
foreach ($articles as $article) {
|
|
||||||
|
foreach ($category_to_articles[$category] as $article)
|
||||||
|
{
|
||||||
array_push($article_names, $article[0]);
|
array_push($article_names, $article[0]);
|
||||||
array_push($article_titles, $article[1]);
|
array_push($article_titles, $article[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$name_to_title = array_combine($article_names, $article_titles);
|
$name_to_title = array_combine($article_names, $article_titles);
|
||||||
asort($name_to_title);
|
asort($name_to_title);
|
||||||
foreach ($name_to_title as $name => $title) { ?>
|
|
||||||
<li><a href="/wiki/<?=$name?>.html"><?=$title?></a></li>
|
|
||||||
<?php } ?>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<?php } ?>
|
foreach ($name_to_title as $name => $title)
|
||||||
|
echo '<li><a href="/wiki/'.$name.'.html">'.$title.'</a></li>';
|
||||||
|
|
||||||
|
echo '</ul><br>';
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php include "../footer.php";
|
||||||
<?php include "../footer.php"; ?>
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: USING Two-Factor Authentication (2FA) ON TILDE.CLUB
|
title: Using Two-Factor Authentication (2FA) on Tilde.club
|
||||||
author: deepend
|
author: deepend
|
||||||
category: tutorials
|
category: tutorials
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: bashblog
|
title: bashblog (blog platform)
|
||||||
author:
|
author:
|
||||||
- deepend
|
- deepend
|
||||||
- benharri
|
- benharri
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
title: bbj
|
title: BBJ (Bulletin Butter & Jelly)
|
||||||
author: audiodude
|
author: audiodude
|
||||||
category: tutorials
|
category: software
|
||||||
---
|
---
|
||||||
bbj: bulletin butter and jelly, a cozy bbs in your terminal
|
bbj: bulletin butter and jelly, a cozy bbs in your terminal
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: "CGI: Making web applications like it's 90s"
|
title: CGI: Making web applications like it's 90s
|
||||||
category: tutorials
|
category: tutorials
|
||||||
author: xwindows
|
author: xwindows
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: custom 404
|
title: custom 404 error page
|
||||||
author: deepend
|
author: deepend
|
||||||
category: tutorials
|
category: tutorials
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: Terminal Multiplexers
|
title: Byobu, TMUX & Screen (terminal multiplexers)
|
||||||
author: rudi
|
author: rudi
|
||||||
category: software
|
category: software
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
author: benharri
|
author: benharri
|
||||||
title: ssh
|
title: How to connect using SSH (secure shell)
|
||||||
category: tutorials
|
category: tutorials
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
author: jeffbonhag
|
author: jeffbonhag
|
||||||
title: SSHFS
|
title: SSHFS (SSH Filesystem)
|
||||||
category: software
|
category: software
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
title: tin
|
title: tin (UseNet reader)
|
||||||
category: software
|
category: software
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
title: ttbp (feels)
|
title: ttbp / feels (blog platform)
|
||||||
author:
|
author: benharri
|
||||||
- benharri
|
|
||||||
category: software
|
category: software
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
title: .vimrc file
|
title: Vim (editor) .vimrc file
|
||||||
category: tutorials
|
category: software
|
||||||
---
|
---
|
||||||
|
|
||||||
The file `.vimrc` in your home directory has instructions for [[vim]]
|
The file `.vimrc` in your home directory has instructions for [[vim]]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
title: Don't use VPN services
|
title: Don't use VPN services
|
||||||
author: joepie91 on github
|
author: joepie91 on github
|
||||||
category: tilde.club
|
category: tutorials
|
||||||
---
|
---
|
||||||
|
|
||||||
# Don't use VPN services.
|
# Don't use VPN services.
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
|
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
|
||||||
$endif$
|
$endif$
|
||||||
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
|
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
|
||||||
<link rel="stylesheet" href="../style.css">
|
<link rel="stylesheet" href="https://tilde.club/style.css">
|
||||||
|
<link rel="icon" type="image/png" href="https://tilde.club/favicon.png">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
code{background: rgba(255, 187, 85, 0.15);padding: 0.1em 0.2em;border-radius: 0.3em;white-space: pre-wrap;}
|
code{background: rgba(255, 187, 85, 0.15);padding: 0.1em 0.2em;border-radius: 0.3em;white-space: pre-wrap;}
|
||||||
pre code{background: none;}
|
pre code{background: none;}
|
||||||
|
|
Loading…
Reference in New Issue