diff --git a/docs/pages/CHANGELOG.md b/docs/pages/CHANGELOG.md index 5c4b635a..9d895c20 100644 --- a/docs/pages/CHANGELOG.md +++ b/docs/pages/CHANGELOG.md @@ -7,9 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added + +- Add `imageZoomableInPost` param to control the zoomable of images in the single post page [#345](https://github.com/g1eny0ung/hugo-theme-dream/pull/345) + ### Changed -- Make TOC scrollable when it is too long +- Make TOC scrollable when it is too long [#340](https://github.com/g1eny0ung/hugo-theme-dream/pull/340) ## [3.9.0] - 2024-11-17 @@ -179,7 +183,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added -- Support image optimization for summary images. See [Image Optimization](https://g1en.site/hugo-theme-dream/summary-images#image-optimization) for more details. +- Support image optimization for summary images. See [Image Optimization](https://g1en.site/hugo-theme-dream/summary-images#image-optimization) for more details ### Changed diff --git a/docs/pages/params-configurations.mdx b/docs/pages/params-configurations.mdx index a88fb8e0..097e9f7f 100644 --- a/docs/pages/params-configurations.mdx +++ b/docs/pages/params-configurations.mdx @@ -53,6 +53,7 @@ stickyNav = true # noDefaultSummaryCover = true showTableOfContents = true showSummaryCoverInPost = true +imageZoomableInPost = true showPrevNextPost = true # reorderShares = ["x", "facebook", "whatsapp"] @@ -262,6 +263,28 @@ Show table of contents in the single post page. Show summary cover image in the single post page. +### imageZoomableInPost + +Make images zoomable in the single post page. This feature uses [medium-zoom](https://github.com/francoischalifour/medium-zoom) under the hood. + + +For advanced usage, you may want to customize the medium-zoom options. Dream allows you to +create a partial file named `medium-zoom.html` in the `layouts/partials` folder to replace the +default behavior. For example, you can put the following code in the `medium-zoom.html` file: + +```html + +``` + + ### showPrevNextPost Show previous and next post links in the single post page. diff --git a/hugo.example.toml b/hugo.example.toml index 0bded92d..ebc779bb 100755 --- a/hugo.example.toml +++ b/hugo.example.toml @@ -54,6 +54,7 @@ siteStartYear = 2016 # noDefaultSummaryCover = true # showTableOfContents = true # showSummaryCoverInPost = true +# imageZoomableInPost = true # showPrevNextPost = true # reorderShares = ["x", "facebook", "whatsapp"] diff --git a/layouts/_default/single.html b/layouts/_default/single.html index a9ccad16..41a2c29f 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -64,11 +64,13 @@

{{ .Title }}

- {{ if and .Params.Cover site.Params.showSummaryCoverInPost }} - {{ .Title }} - {{ end }} +
+ {{ if and .Params.Cover site.Params.showSummaryCoverInPost }} + {{ .Title }} + {{ end }} - {{ .Content | emojify }} + {{ .Content | emojify }} +
{{ if site.Params.showPrevNextPost }}
@@ -149,4 +151,15 @@

{{ .Title }}

{{ end }} +{{ if site.Params.imageZoomableInPost }} + {{ if fileExists "layouts/partials/medium-zoom.html" }} + {{ partialCached "medium-zoom.html" . }} + {{ else }} + + {{ end }} +{{ end }} + {{ end }}