From 8d6e0797b52d2160fe2f7b2e732b4cd18f89a926 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Mon, 24 Oct 2022 13:31:41 +0800 Subject: [PATCH] Unstyle internal site links globally --- assets/templates/site.scss | 15 +++++++++++++++ layouts/partials/head.html | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 assets/templates/site.scss diff --git a/assets/templates/site.scss b/assets/templates/site.scss new file mode 100644 index 0000000..365ae70 --- /dev/null +++ b/assets/templates/site.scss @@ -0,0 +1,15 @@ +{{/* + This is a site-specific styling that have to be generated. +*/}} + +/* Internal links are not to be styled. */ +{{- $baseURL := urls.Parse $.Site.BaseURL }} +a[href]:where( + a[href^="http://{{- $baseURL.Host -}}"], + a[href^="https://{{- $baseURL.Host -}}"], + a[href$="{{- $baseURL.Host -}}"], + a[href$="{{- $baseURL.Host -}}/"], + a[href^="{{- $.Site.BaseURL -}}"], +)::after { + content: unset; +} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 42d1c27..18d69e0 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -6,11 +6,11 @@ {{- $main := resources.Get "scss/main.scss" | resources.ToCSS }} {{- /* Combine all of the custom schems in under one stylesheet */ -}} -{{ $scheme_template := resources.Get "templates/theme.scss" }} -{{- $themes := $scheme_template | resources.ExecuteAsTemplate "css/themes.css" . | resources.ToCSS }} +{{- $themes := resources.Get "templates/theme.scss" | resources.ExecuteAsTemplate "css/themes.css" . | resources.ToCSS }} +{{- $siteSpecificTheme := resources.Get "templates/site.scss" | resources.ExecuteAsTemplate "css/site.css" . | resources.ToCSS }} {{- /* Append the main stylesheet to be the last so the resulting stylesheet will make the custom colorschemes at the front. */ -}} -{{ $stylesheets = $stylesheets | append $themes $main }} +{{ $stylesheets = $stylesheets | append $themes $main $siteSpecificTheme }} {{ $style := $stylesheets | resources.Concat "css/main.css" }}