Skip to content

Commit f68d5c9

Browse files
committed
Full filepath
1 parent d2ea54b commit f68d5c9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

layouts/shortcodes/show-on-path.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@
1313
{{ $filepath := .Get "filepath" }}
1414
{{ $currentPath := .Page.RelPermalink }}
1515

16+
{{ $fullFilepath = printf "%s%s" .Site.BaseURL $filepath }}
17+
{{ $fullCurrentPath = printf "%s%s" .Site.BaseURL $filepath }}
18+
1619
{{/* Remove trailing slash from both paths for consistent comparison */}}
17-
{{ $normalizedFilepath := cond (strings.HasSuffix $filepath "/") (substr $filepath 0 (sub (len $filepath) 1)) $filepath }}
18-
{{ $normalizedCurrentPath := cond (strings.HasSuffix $currentPath "/") (substr $currentPath 0 (sub (len $currentPath) 1)) $currentPath }}
20+
{{ $normalizedFilepath := cond (strings.HasSuffix $fullFilepath "/") (substr $filepath 0 (sub (len $filepath) 1)) $filepath }}
21+
{{ $normalizedCurrentPath := cond (strings.HasSuffix $fullCurrentPath "/") (substr $currentPath 0 (sub (len $currentPath) 1)) $currentPath }}
1922

2023
{{/* Debug output */}}
2124
<div style="border: 1px solid red; padding: 10px; margin: 10px 0; background: #ffe6e6;">

0 commit comments

Comments
 (0)