From c5b103c85feafa96d5e5ecc572b043331d4a6bd4 Mon Sep 17 00:00:00 2001
From: Md Jawad Noor Asif <jawad.asif.bd@gmail.com>
Date: Wed, 04 Jan 2023 03:10:25 +0000
Subject: [PATCH] fix: fix unicode broken tags (#261)

---
 layouts/partials/textprocessing.html |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/layouts/partials/textprocessing.html b/layouts/partials/textprocessing.html
index 7b82f32..dbcc053 100644
--- a/layouts/partials/textprocessing.html
+++ b/layouts/partials/textprocessing.html
@@ -42,7 +42,24 @@
     <!-- remove subfolder from title -->
     {{$display := index (last 1 (split $display "/")) 0}}
 
-    {{$curpage := $page.GetPage $title}}
+    <!-- attempt to get title -->
+    {{$searchtitle := $title }}
+    {{$curpage := $page.GetPage $searchtitle }}
+    <!-- attempt to search md file instead  -->
+    {{ if (eq $curpage.String "nopPage") }}
+      {{$searchtitle = (add $title ".md") }}
+      {{$curpage = $page.GetPage $searchtitle }}
+    {{ end }}
+    <!-- attempt to reverse typographer behaviour  -->
+    {{ if (eq $curpage.String "nopPage") }}
+      {{$searchtitle = (replace $searchtitle "&amp;" "&") }}
+      {{$searchtitle = (replace $searchtitle "&quot;" "\"") }}
+      {{$searchtitle = (replace $searchtitle "&rdquo;" "\"") }}
+      {{$searchtitle = (replace $searchtitle "&ldquo;" "\"") }}
+      {{$searchtitle = (replace $searchtitle "&rsquo;" "'") }}
+      {{$searchtitle = (replace $searchtitle "&lsquo;" "'") }}
+      {{$curpage = $page.GetPage $searchtitle }}
+    {{ end }}
     {{$relpath := relURL $path}}
 
     <!-- If path to Hugo page -->

--
Gitblit v1.10.0