From 54c3ac0446c4659c0edf8b85701ba05ba963a032 Mon Sep 17 00:00:00 2001 From: razonyang Date: Tue, 23 May 2023 17:25:10 +0800 Subject: [PATCH] fix: repo widget Use hugo.WorkingDir instead of Site.Language.ContentDir to generate the edit and view links --- exampleSite/config/_default/config.toml | 3 +++ layouts/partials/docs/repo.html | 4 ++-- layouts/partials/functions/working-directory.html | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 layouts/partials/functions/working-directory.html diff --git a/exampleSite/config/_default/config.toml b/exampleSite/config/_default/config.toml index 36bf13b8b..a0665c276 100644 --- a/exampleSite/config/_default/config.toml +++ b/exampleSite/config/_default/config.toml @@ -45,3 +45,6 @@ timeout = "120s" [build] writeStats = true + +[security.funcs] + getenv = ['^HUGO_', '^CI$', 'PWD'] diff --git a/layouts/partials/docs/repo.html b/layouts/partials/docs/repo.html index e7aea1b70..015cd94f3 100644 --- a/layouts/partials/docs/repo.html +++ b/layouts/partials/docs/repo.html @@ -12,7 +12,7 @@ {{- $branch := default "master" .branch -}} {{- $dateFormat := default "02/01/2006, 15:04:05 PM" .dateFormat -}} {{- $subPath := default "" .subPath -}} -{{- $contentDir := default "content" $.Site.Language.ContentDir -}} +{{- $root := partialCached "functions/working-directory" . }} {{- if $subPath -}}{{ $subPath = printf "/%s" $subPath }}{{- end -}}