Back to Redis

Meta Links

layouts/partials/meta-links.html

latest1.1 KB
Original Source

{{ $gh_repo := .Site.Params.gitHubRepo }} {{ $gh_path := .File.Dir }} {{ $gh_file := .File.LogicalName }} {{ $gh_branch := "main" }} {{ $parts := split .RelPermalink "/" }} {{ if eq (index $parts 1) "staging" }} {{ $gh_branch := index $parts 2 }} {{ end }} {{ if eq $gh_branch "dev" }} {{ $gh_branch := "main" }} {{ end }} {{ $stripped_filename := replaceRE (_index.md)$|(index.md)$|(.md)$ "" $gh_file | lower }} {{ $editURL := printf "%s/edit/%s/content/%s%s" $gh_repo $gh_branch $gh_path $gh_file }} {{ $issuesURL := printf "%s/issues/new?title=Feedback: %s&body=Page https://redis.io/docs/latest/%s%s" $gh_repo (safeURL $.Title ) $gh_path $stripped_filename }} {{/* Get the markdown output format URL and generate a proper filename */}} {{ $markdownURL := "" }} {{ range .AlternativeOutputFormats }} {{ if eq .Name "markdown" }} {{ $markdownURL = .Permalink }} {{ end }} {{ end }} {{/* Generate a filename based on the page path */}} {{ $filename := "" }} {{ if $stripped_filename }} {{ $filename = printf "%s.md" $stripped_filename }} {{ else }} {{ $filename = printf "%s.md" (replaceRE "[^a-zA-Z0-9-]+" "-" .Title | lower) }} {{ end }}