diff options
| author | tdro <tdro@noreply.example.com> | 2022-06-02 20:29:14 -0400 |
|---|---|---|
| committer | tdro <tdro@noreply.example.com> | 2022-06-02 20:29:14 -0400 |
| commit | 4e26be95074a0be4f9cd45a1f3fc9b6dfe0790bd (patch) | |
| tree | f81827fda491f710550df0d5df988d69fc85a497 | |
| parent | d0713b5c29257f689981364d6b4c5df9863dc96a (diff) | |
| download | canory-4e26be95074a0be4f9cd45a1f3fc9b6dfe0790bd.tar.gz canory-4e26be95074a0be4f9cd45a1f3fc9b6dfe0790bd.tar.bz2 canory-4e26be95074a0be4f9cd45a1f3fc9b6dfe0790bd.zip | |
themes/default/layouts: Use urls.Parse instead of regular expression
For domain/host lookup.
| -rw-r--r-- | themes/default/layouts/partials/card-meta.html | 2 | ||||
| -rw-r--r-- | themes/default/layouts/partials/feeds-generate.html | 2 | ||||
| -rw-r--r-- | themes/default/layouts/partials/meta-handle.html | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/themes/default/layouts/partials/card-meta.html b/themes/default/layouts/partials/card-meta.html index 0f3b9a5..b338412 100644 --- a/themes/default/layouts/partials/card-meta.html +++ b/themes/default/layouts/partials/card-meta.html @@ -9,7 +9,7 @@ {{ safeHTML (readFile "static/icons/feather/rss.svg") }} <a data-hover target="_blank" - title="{{ partial "author-user.html" . }}@{{ replaceRE "^https?://([^/]+).*" "$1" .Site.BaseURL }}" + title="{{ partial "author-user.html" . }}@{{ (urls.Parse .Site.BaseURL).Host }}" href="{{ .Site.BaseURL }}/{{ partial "author-user.html" . }}"> via @{{ partial "author-user.html" . }} </a> diff --git a/themes/default/layouts/partials/feeds-generate.html b/themes/default/layouts/partials/feeds-generate.html index ca88409..e32c250 100644 --- a/themes/default/layouts/partials/feeds-generate.html +++ b/themes/default/layouts/partials/feeds-generate.html @@ -92,7 +92,7 @@ "FeedSourceLink" ($sourceLink | plainify | htmlUnescape) "FeedSourceTitle" ($sourceTitle | plainify | htmlUnescape) "FeedTitle" ($title | plainify | htmlUnescape) - "FeedSourceDomain" ($sourceLink | plainify | htmlUnescape | replaceRE "^https?://([^/]+).*" "$1") + "FeedSourceDomain" (($sourceLink | plainify | htmlUnescape | urls.Parse).Host) ) }} diff --git a/themes/default/layouts/partials/meta-handle.html b/themes/default/layouts/partials/meta-handle.html index a46eb0c..d07b051 100644 --- a/themes/default/layouts/partials/meta-handle.html +++ b/themes/default/layouts/partials/meta-handle.html @@ -7,7 +7,7 @@ </a> {{- else -}} <a - title="{{ partial "author-user.html" . }}@{{ replaceRE "^https?://([^/]+).*" "$1" .Site.BaseURL }}" + title="{{ partial "author-user.html" . }}@{{ (urls.Parse .Site.BaseURL).Host }}" href="{{ .Site.BaseURL }}/{{ partial "author-user.html" . }}"> @{{ partial "author-user.html" . }} </a> |
