Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/it-gro/hugo-theme-w3css-basic.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-gro <grossnik@tuvok>2018-08-26 10:15:19 +0300
committerit-gro <grossnik@tuvok>2018-08-26 10:15:19 +0300
commita091e3fb437ba4ed112c930071d71195804abb37 (patch)
treeba7662f293d9886b6ba737252166430c89a1d0e3
parentb97c2195e9719fde529653404799fc6dde595f57 (diff)
Fix resource RelPermalink (for HUGO_CANONIFYURLS true-or-false)
-rw-r--r--exampleSite/content/pages/showcase/gallery-01.md8
-rw-r--r--layouts/partials/resource.image.html18
2 files changed, 21 insertions, 5 deletions
diff --git a/exampleSite/content/pages/showcase/gallery-01.md b/exampleSite/content/pages/showcase/gallery-01.md
index 379be70..b02b3e7 100644
--- a/exampleSite/content/pages/showcase/gallery-01.md
+++ b/exampleSite/content/pages/showcase/gallery-01.md
@@ -28,11 +28,11 @@ using shortcode:
* More examples:
[Images taken from ...](../../hugo-theme-w3css-basic/images-taken-from/)
-* See [Gallery with image processing (shortcode res-gallery)]({{< relref "pages/hugo-theme-w3css-basic/page-shortcodes/index.md#res-gallery" >}})
- and [Figure with processing (Demo shortcode res-figure)]({{< relref "image-processing-with-hugo" >}}) as well
+* See [Gallery with image processing (shortcode res-gallery)]({{< relref "/pages/hugo-theme-w3css-basic/page-shortcodes/index.md#res-gallery" >}})
+ and [Figure with processing (Demo shortcode res-figure)]({{< relref "/image-processing-with-hugo" >}}) as well
-* Compare with [shortcode heg-gallery]({{< relref "pages/hugo-theme-w3css-basic/page-shortcodes/index.md#heg-gallery" >}})
- and [shortcode heg-figure]( {{< relref "pages/hugo-theme-w3css-basic/page-shortcodes/index.md#heg-figure" >}})
+* Compare with [shortcode heg-gallery]({{< relref "/pages/hugo-theme-w3css-basic/page-shortcodes/index.md#heg-gallery" >}})
+ and [shortcode heg-figure]( {{< relref "/pages/hugo-theme-w3css-basic/page-shortcodes/index.md#heg-figure" >}})
as well
diff --git a/layouts/partials/resource.image.html b/layouts/partials/resource.image.html
index 8976044..fa1cce3 100644
--- a/layouts/partials/resource.image.html
+++ b/layouts/partials/resource.image.html
@@ -67,10 +67,26 @@ theResImgOpt : {{- $theResImgOpt }} <br/>
{{- $myImage := $thePage.Scratch.Get `myImage` }}
{{- if $myImage }}
+{{- $myBaseUrlSubDirs := replaceRE `^(http(s)?)?://(.*?)/` `` $thePage.Site.BaseURL }}
+ {{- if not (findRE (printf "^/%s" $myBaseUrlSubDirs) $myImage.RelPermalink) }}
+ {{- $thePage.Scratch.Set `myImageRelPermalink` (printf "%s/%s" $myBaseUrlSubDirs $myImage.RelPermalink ) }}
+ {{- end }}
+ {{- $myImageRelPermalink := ($thePage.Scratch.Get `myImageRelPermalink`) | default $myImage.RelPermalink }}
<img
class="{{ $theImgClass }}"
style="{{ $theImgStyle | safeCSS }}"
- src='{{$thePage.Site.BaseURL}}/{{ $myImage.RelPermalink }}'
+ src='{{ $myImageRelPermalink | absURL }}'
alt='{{ $myImage.RelPermalink }}'
+ data-dbg-Site.BaseURL='{{$thePage.Site.BaseURL }}'
+ data-dbg-myBaseUrlSubDirs='{{$myBaseUrlSubDirs }}'
+ data-dbg-myImageRelPermalink='{{$myImageRelPermalink }}'
+ data-dbg-myImageRelPermalink-absURL='{{$myImageRelPermalink | absURL }}'
+ data-dbg-myResource-Permalink='{{$myResource.Permalink }}'
+ data-dbg-myImage-Permalink='{{$myImage.Permalink }}'
+ data-dbg-myImage-Permalink-absURL='{{$myImage.Permalink | absURL }}'
+ data-dbg-myImage-Permalink-relURL='{{$myImage.Permalink | relURL }}'
+ data-dbg-myResource-RelPermalink='{{$myResource.RelPermalink }}'
+ data-dbg-myImage-RelPermalink='{{$myImage.RelPermalink }}'
+ data-dbg-myImage-RelPermalink-absURL='{{$myImage.RelPermalink | absURL }}'
>
{{- end }}