From bfda29b7b3a1ff8405da0d82fd5825dd97b407ab Mon Sep 17 00:00:00 2001 From: Geri Ochoa Date: Wed, 17 Aug 2022 15:02:16 -0400 Subject: [PATCH] Create custom meta-links Because Tekton imports content from several repos, this custom partial ensures that the "edit" link points to the correct location. --- layouts/partials/page-meta-links.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 layouts/partials/page-meta-links.html diff --git a/layouts/partials/page-meta-links.html b/layouts/partials/page-meta-links.html new file mode 100644 index 0000000..8cfffc1 --- /dev/null +++ b/layouts/partials/page-meta-links.html @@ -0,0 +1,26 @@ +{{ if .Path }} +{{ $gh_repo := ($.Param "github_repo") }} +{{ $gh_subdir := ($.Param "github_subdir") }} +{{ $gh_project_repo := ($.Param "github_project_repo") }} +{{ if $gh_repo }} +
+{{ $editURL := printf "%s/edit/main/content/%s" $gh_repo .Path }} +{{ if $gh_project_repo }} +{{ $filename := .File.LogicalName }} +{{ if and $gh_project_repo (eq $filename "_index.md") }} +{{ $filename = "README.md" }} +{{ end }} +{{ $editURL = printf "%s/edit/main/docs/%s" $gh_project_repo $filename }} +{{ else if and ($gh_subdir) (.Site.Language.Lang) }} +{{ $editURL = printf "%s/edit/main/%s/content/%s/%s" $gh_repo $gh_subdir ($.Site.Language.Lang) $.Path }} +{{ else if .Site.Language.Lang }} +{{ $editURL = printf "%s/edit/main/content/%s/%s" $gh_repo ($.Site.Language.Lang) .Path }} +{{ else if $gh_subdir }} +{{ $editURL = printf "%s/edit/main/%s/content/%s" $gh_repo $gh_subdir $.Path }} +{{ end }} +{{ $issuesURL := printf "%s/issues/new?title=%s" $gh_repo (htmlEscape ($.Title | default $.LinkTitle ))}} + {{ T "post_edit_this" }} + {{ T "post_create_issue" }} +
+{{ end }} +{{ end }} \ No newline at end of file -- GitLab