mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-24 06:55:42 -05:00
Only remove .md suffix on internal links
This commit is contained in:
parent
b04f7105e3
commit
7b835a80bd
@ -1,9 +1,9 @@
|
||||
{{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}}
|
||||
{{$dashedurl := replace $trimmed "%20" "-" }}
|
||||
{{$dashedurl := replace .Destination "%20" "-" }}
|
||||
{{$external := strings.HasPrefix $dashedurl "http" }}
|
||||
{{- if $external -}}
|
||||
<a href="{{ $dashedurl }}" rel="noopener">{{ .Text | safeHTML }}</a>
|
||||
<a href="{{ $dashedurl }}" target="_blank" rel="noopener noreferrer">{{ .Text | safeHTML }}</a>
|
||||
{{- else -}}
|
||||
{{$trimmed := strings.TrimSuffix ".md" (.Destination | safeURL)}}
|
||||
{{$spacedurl := replace $trimmed "%20" " " }}
|
||||
{{$fixedUrl := (cond (hasPrefix $spacedurl "/") $spacedurl (print "/" $spacedurl)) | urlize}}
|
||||
{{$nonexistent := eq (.Page.GetPage $spacedurl).RelPermalink ""}}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user