From 062139185c02e98880f009c23a8693dd300610d0 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Tue, 23 May 2023 04:10:02 +0400 Subject: [PATCH] Instead of populating an articles table by hand, load it from articles fs. --- internal/http/handlers.go | 2 +- web/templates/stuff.pug | 33 +++++++-------------------------- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/internal/http/handlers.go b/internal/http/handlers.go index 8470291..2c59323 100644 --- a/internal/http/handlers.go +++ b/internal/http/handlers.go @@ -41,7 +41,7 @@ func (h *Handlers) Index(w http.ResponseWriter, r *http.Request) { func (h *Handlers) Stuff(w http.ResponseWriter, r *http.Request) { web.Stuff("/ Stuff", util.GetServiceByHost(r.Host, util.ServiceGit), - util.GetServiceByHost(r.Host, util.ServiceFiles), w) + util.GetServiceByHost(r.Host, util.ServiceFiles), web.GetArticlesMetadata(), w) } func (h *Handlers) Mindflow(w http.ResponseWriter, r *http.Request) { diff --git a/web/templates/stuff.pug b/web/templates/stuff.pug index daad642..c77adba 100755 --- a/web/templates/stuff.pug +++ b/web/templates/stuff.pug @@ -11,37 +11,18 @@ block nav h1 Stuff block content - :go:func Stuff(title, git_site, files_site string) + :go:func Stuff(title, git_site, files_site string, metadata []ArticleMetadata) p.center Here lies everything I've made that I'm willing to share. section#articles h2 Articles p These articles are more like the sysadmin's notes. I describe those parts here that I did myself. The date here represents when article was updated last time. table - tr - td - time(datetime='2022-05-20') 20 May 2022 - td - a(href='stuff/article/hardening_mikrotik') Hardening Mikrotik - tr - td - time(datetime='2021-11-15') 15 November 2021 - td - a(href='stuff/article/nginx_recipes_and_tips') NGiNX's recipes & tips - tr - td - time(datetime='2022-07-17') 17 July 2022 - td - a(href='stuff/article/setting_up_a_mail_server') Setting up a mail server - tr - td - time(datetime='2020-08-15') 15 August 2020 - td - a(href='stuff/article/setting_up_a_tor_proxy_relay_hiddenserv') Setting up a Tor proxy, relay and hidden service - tr - td - time(datetime='2022-05-19') 19 May 2022 - td - a(href='stuff/article/rpi_root_on_external_drive') How to move a root partition from SD card off to external drive on Raspberry Pi + each entry in metadata + tr + td + time(datetime=entry.Date.Format("2006-02-01")) #{entry.Date.Format("01 January 2006")} + td + a(href=entry.URL) #{entry.Title} section#programs-scripts h2 Programs and scripts p.center Simple, yet useful (at least for me) programs and scripts I made.