From d3708001d87b7008db4a20f17fac49a0d0507fd6 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Mon, 25 Apr 2022 14:26:33 +0100 Subject: [PATCH] Use previous release examples in codenew shortcode Fix a minor bug in the codenew shortcode. When serving a previous release, link to the example for that specific release (and not to the example for the current release). --- layouts/shortcodes/codenew.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/shortcodes/codenew.html b/layouts/shortcodes/codenew.html index 4c860be19d..30b6aae4f0 100644 --- a/layouts/shortcodes/codenew.html +++ b/layouts/shortcodes/codenew.html @@ -4,7 +4,7 @@ {{ $fileDir := path.Split $file }} {{ $bundlePath := path.Join .Page.File.Dir $fileDir.Dir }} {{ $filename := printf "/content/%s/examples/%s" .Page.Lang $file | safeURL }} -{{ $ghlink := printf "https://%s/main%s" site.Params.githubwebsiteraw $filename | safeURL }} +{{ $ghlink := printf "https://%s/%s%s" site.Params.githubwebsiteraw (default "main" site.Params.docsbranch) $filename | safeURL }} {{/* First assume this is a bundle and the file is inside it. */}} {{ $resource := $p.Resources.GetMatch (printf "%s*" $file ) }} {{ with $resource }}