diff options
author | amzrk2 | 2020-04-20 17:19:48 +0800 |
---|---|---|
committer | amzrk2 | 2020-04-20 17:19:48 +0800 |
commit | ab5bb96c27dae05d187a566d56d2ff4adafada51 (patch) | |
tree | d532140608369ed3593853a06f30c5ef2ed7db1a /README.md | |
parent | 0f2b7dff157e33660048d0b7fe7e014609fce6ab (diff) | |
download | hugo-theme-fuji-ab5bb96c27dae05d187a566d56d2ff4adafada51.tar.gz hugo-theme-fuji-ab5bb96c27dae05d187a566d56d2ff4adafada51.tar.bz2 hugo-theme-fuji-ab5bb96c27dae05d187a566d56d2ff4adafada51.zip |
Apply lazyload to images in markdown content
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -51,6 +51,22 @@ If you want to generate your site, just run: $ hugo --minify ``` +## Advance configration + +You can create the files below in your site to adjust the markdown render hook, see [Hugo's Official Docs](https://gohugo.io/getting-started/configuration-markup#markdown-render-hooks). + +You can use ```layouts/_default/_markup/render-link.html``` to decide whether or not links in the markdown content will open in new tab: + +```html +<a href="{{ .Destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank"{{ end }}>{{ .Text | safeHTML }}</a> +``` + +You can use ```layouts/_default/_markup/render-image.html``` to change the lazyload placeholder: + +```html +<p><img class="lazy" src="https://cdn.jsdelivr.net/gh/amzrk2/poal-jsdelivr@1.0.0/lazyload/dsr_loading.svg" data-src="{{ .Destination | safeURL }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}"{{ end }} /></p> +``` + ## Update the theme Inside the folder of your Hugo site run: |