diff --git a/layouts/partials/textprocessing.html b/layouts/partials/textprocessing.html
index 6776fa5b1..3f6df5d49 100644
--- a/layouts/partials/textprocessing.html
+++ b/layouts/partials/textprocessing.html
@@ -35,23 +35,26 @@
{{$inner := . | strings.TrimPrefix "[[" | strings.TrimSuffix "]]" }}
{{$split := split $inner "|"}}
+
{{$path := index $split 0}}
{{$reference := split $path "#"}}
{{$title := index $reference 0}}
-
- {{$block := default "" (index $reference 1)}}
- {{$block = strings.TrimRight "/" (cond (eq $block "") $block (printf "#%s" $block)) | urlize | lower}}
- {{$href := strings.TrimRight "/" ($page.GetPage $title).RelPermalink}}
+
{{$display := default $title (index $split 1)}}
-
+
{{$display := index (last 1 (split $display "/")) 0}}
- {{if not $href}}
- {{$link := printf "%s" $display}}
+
+ {{if eq (string ($page.GetPage $title)) "nopPage"}}
+ {{$path := index $split 0 | relURL}}
+ {{$link := printf "%s" $path $display}}
{{$content = replace $content . $link}}
{{else}}
+ {{$block := default "" (index $reference 1)}}
+ {{$block = strings.TrimRight "/" (cond (eq $block "") $block (printf "#%s" $block)) | urlize | lower}}
+ {{$href := strings.TrimRight "/" ($page.GetPage $title).RelPermalink}}
{{$fullhref := printf "%s%s" $href $block }}
{{$link := printf "%s" $fullhref $href $display}}
{{$content = replace $content . $link}}