From 361d2c712e60d41a6e055730369243f033f4384d Mon Sep 17 00:00:00 2001 From: zaaarf Date: Sat, 20 Jan 2024 17:28:18 +0100 Subject: [PATCH] feat: random subtitle via external api --- config.toml | 6 ++++++ templates/index.html | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/config.toml b/config.toml index 868e465..8cb17f4 100644 --- a/config.toml +++ b/config.toml @@ -78,6 +78,12 @@ subtitle_suffixes = [ ", random!" ] +# You can fetch the subtitles from an API instead, setting these two parameters: +# random_api = "api.url" # url of the API +# random_api_param = "name" # parameter within the JSON to look at for +# I recommend https://git.alemi.dev/mood/ for this, in that case "mood" would the random_api_param, +# and the url would be wherever you set the endpoint to be. + # Social icons, list here: https://github.com/rhazdon/hugo-theme-hello-friend-ng/blob/master/layouts/partials/svg.html social_icons = [ { name = "github", at = "https://github.com/zaaarf" }, diff --git a/templates/index.html b/templates/index.html index 31ca9e8..7de9d17 100644 --- a/templates/index.html +++ b/templates/index.html @@ -17,7 +17,23 @@ {{ svg::draw_icons(icons=config.extra.home.social_icons) }} {% endif %} -{% if config.extra.home.subtitle_suffixes %} +{% if config.extra.home.random_api and config.extra.home.random_api_param %} + +{% elif config.extra.home.subtitle_suffixes %}