diff options
author | Ivan Boothe <git@rootwork.org> | 2022-06-11 00:34:37 +0300 |
---|---|---|
committer | Ivan Boothe <git@rootwork.org> | 2022-06-11 00:34:37 +0300 |
commit | 9eae1ae81ca4b52160fef9706d81b18df50e099a (patch) | |
tree | 8c414a17659aa0843c94eafd57a9f7b4b73ed0d1 | |
parent | b387006a1dcefb26a1546986c27ff90f3a3a2996 (diff) |
Ensuring image functions read configurable imagesDir path
Signed-off-by: Ivan Boothe <git@rootwork.org>
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | assets/sass/_components.sass | 2 | ||||
-rw-r--r-- | exampleSite/content/post/markdown-syntax.md | 4 | ||||
-rw-r--r-- | exampleSite/content/post/markdown-syntax.pt.md | 4 | ||||
-rw-r--r-- | exampleSite/content/post/notices.md | 4 | ||||
-rw-r--r-- | layouts/_default/_markup/render-image.html | 3 | ||||
-rw-r--r-- | layouts/partials/image.html | 3 |
7 files changed, 14 insertions, 12 deletions
@@ -398,9 +398,9 @@ Image captions are automatically generated. If an image has title text, the capt Examples of captions: -- `![Jane Doe](/images/jane-doe.png)` will display the local `jane-doe.png` image with a caption of "Jane Doe". +- `![Jane Doe](../images/jane-doe.png)` will display the local `jane-doe.png` image with a caption of "Jane Doe". - `![Jane Doe](https://raw.githubusercontent.com/chipzoller/hugo-clarity/master/exampleSite/static/images/jane-doe.png "This is Jane Doe")` will display the remote image `jane-doe.png` with a caption of "This is Jane Doe". -- `![A building](/images/building.png " ")` will display the local image `building.png` with no caption. +- `![A building](../images/building.png " ")` will display the local image `building.png` with no caption. Examples of this can also be found in the "Markdown Syntax Guide" post in the example site content. @@ -894,4 +894,4 @@ __Search Scope__ For example, if you have 3 sections in your content i.e `blog`, `docs` & `examples`, searching in the `docs` section will only produce results for that section. - Searching outside a section will search the entire site. - For example, with the above setup, searching from the homepage will produce results from the entire site.
\ No newline at end of file + For example, with the above setup, searching from the homepage will produce results from the entire site. diff --git a/assets/sass/_components.sass b/assets/sass/_components.sass index 56c7db4..7d091e7 100644 --- a/assets/sass/_components.sass +++ b/assets/sass/_components.sass @@ -213,7 +213,7 @@ height: 50vh max-height: 35rem background-color: $bg - // background-image: url(/images/island.jpg) + // background-image: url(#{$imagesPath}island.jpg) background-size: cover background-position: center margin-top: 4.2rem diff --git a/exampleSite/content/post/markdown-syntax.md b/exampleSite/content/post/markdown-syntax.md index 4e9245b..c9b8062 100644 --- a/exampleSite/content/post/markdown-syntax.md +++ b/exampleSite/content/post/markdown-syntax.md @@ -46,7 +46,7 @@ Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sap The following image is located within the Hugo site. Because it has alt text but no title text, the caption is generated by the alt text. -![Jane Doe](/images/jane-doe.png) +![Jane Doe](../images/jane-doe.png) ### Remote image, specified caption @@ -58,7 +58,7 @@ The following image is loaded from a remote URL. The alt text is the same (for s Alt text is always recommended for SEO, accessibility and in cases when images don't load. However, you don't necessarily always want an image to have a caption. In that case, use a title with one space: -![A building](/images/building.png " ") +![A building](../images/building.png " ") ## Blockquotes diff --git a/exampleSite/content/post/markdown-syntax.pt.md b/exampleSite/content/post/markdown-syntax.pt.md index 74a6293..695235a 100644 --- a/exampleSite/content/post/markdown-syntax.pt.md +++ b/exampleSite/content/post/markdown-syntax.pt.md @@ -51,7 +51,7 @@ Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sap The following image is located within the Hugo site. Because it has alt text but no title text, the caption is generated by the alt text. -![Jane Doe](/images/jane-doe.png) +![Jane Doe](../images/jane-doe.png) ### Remote image, specified caption @@ -63,7 +63,7 @@ The following image is loaded from a remote URL. The alt text is the same (for s Alt text is always recommended for SEO, accessibility and in cases when images don't load. However, you don't necessarily always want an image to have a caption. In that case, use a title with one space: -![A building](/images/building.png " ") +![A building](../images/building.png " ") ## Blockquotes diff --git a/exampleSite/content/post/notices.md b/exampleSite/content/post/notices.md index 34ecd44..cdc18ee 100644 --- a/exampleSite/content/post/notices.md +++ b/exampleSite/content/post/notices.md @@ -61,7 +61,7 @@ public void SayHello() If you're using VS Code for your editing, copy the `.vscode\clarity.code-snippets` file into a `.vscode` root folder on your repo. This will enable you to type `note` then `<tab>` then choose with up/down arrows which flavor notice you want, then `<tab>` again to provide a title, then `<tab>` to add your content! -![](/images/Note-Snippet.gif) +![](../images/Note-Snippet.gif) To use the snippet, you need to first **enable quickSuggestions for Markdown** (one time only): @@ -74,4 +74,4 @@ To use the snippet, you need to first **enable quickSuggestions for Markdown** ( } ``` 4. Close and save the settings. -{{% /notice %}}
\ No newline at end of file +{{% /notice %}} diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 5ca7332..2ddb29a 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,4 +1,5 @@ {{- $file := .Destination -}} +{{- $imagesDir := .Page.Site.Params.imagesDir -}} {{- $alt := .Text -}} {{- $cap := .Title -}} {{- $scratch := newScratch -}} @@ -24,7 +25,7 @@ {{- $image = "" -}} {{- $scratch.Add "classes" " image_svg" -}} {{- else -}} - {{- $file = path.Join "images" $image -}} + {{- $file = path.Join $imagesDir $image -}} {{- $image = $image.Content | resources.FromString $file -}} {{- end -}} {{- else -}} diff --git a/layouts/partials/image.html b/layouts/partials/image.html index c9b9662..a5cae3e 100644 --- a/layouts/partials/image.html +++ b/layouts/partials/image.html @@ -1,4 +1,5 @@ {{- $file := .file -}} +{{- $imagesDir := .Page.Site.Params.imagesDir -}} {{- $alt := .alt -}} {{- if not $alt -}} {{- $alt = .Text -}} @@ -34,7 +35,7 @@ {{- $image = "" -}} {{- $scratch.Add "classes" " image_svg" -}} {{- else -}} - {{- $file = path.Join "images" $image -}} + {{- $file = path.Join $imagesDir $image -}} {{- $image = $image.Content | resources.FromString $file -}} {{- end -}} {{- else -}} |