diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d3d9f2536e3..ef9e7cdb33e 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,6 +1,14 @@ {{ partial "header.html" . }} -{{ .Content }} +{{$wikilinks := .Content | findRE "\\[\\[([^/]+)\\]\\]" }} +{{$temp_content := $.Content}} +{{range $wikilinks}} + {{$page_title := . | strings.TrimPrefix "[[" | strings.TrimSuffix "]]" }} + {{range first 1 (where site.Pages "Params.title" $page_title)}} + {{$temp_content = ($temp_content | replaceRE (printf "\\[\\[%s\\]\\]" $page_title) (printf "[[%s]]" .Permalink $page_title) )}} + {{end}} +{{end}} +{{$temp_content | safeHTML}}