diff --git a/assets/css/_page/_home.scss b/assets/css/_page/_home.scss index 6e48d6f..b6ce5b2 100644 --- a/assets/css/_page/_home.scss +++ b/assets/css/_page/_home.scss @@ -100,6 +100,10 @@ height: 100%; left: 0; top: 0; + @include object-fit(none); + } + + img.lazyloaded { @include object-fit(cover); } diff --git a/assets/css/_page/_single.scss b/assets/css/_page/_single.scss index ef794dd..6d550cc 100644 --- a/assets/css/_page/_single.scss +++ b/assets/css/_page/_single.scss @@ -40,11 +40,15 @@ img { display: block; - width: 100%; + max-width: 100%; height: auto; margin: 0 auto; overflow: hidden; } + + img.lazyloaded { + width: 100%; + } } .content { @@ -321,3 +325,7 @@ @import "../_partial/_single/footer"; @import "../_partial/_single/comment"; } + +.lg-toolbar .lg-icon::after { + color: #999; +} diff --git a/assets/data/social.yml b/assets/data/social.yml index 7580005..c2cc2b6 100644 --- a/assets/data/social.yml +++ b/assets/data/social.yml @@ -1,511 +1,511 @@ # 001: Github github: - weight: 1 - prefix: https://github.com/ - title: GitHub - icon: - class: fab fa-github-alt fa-fw + Weight: 1 + Prefix: https://github.com/ + Title: GitHub + Icon: + Class: fab fa-github-alt fa-fw # 002: LinkedIn linkedin: - weight: 2 - prefix: https://linkedin.com/in/ - title: LinkedIn - icon: - class: fab fa-linkedin fa-fw + Weight: 2 + Prefix: https://linkedin.com/in/ + Title: LinkedIn + Icon: + Class: fab fa-linkedin fa-fw # 003: Twitter twitter: - weight: 3 - prefix: https://twitter.com/ - title: Twitter - icon: - class: fab fa-twitter fa-fw + Weight: 3 + Prefix: https://twitter.com/ + Title: Twitter + Icon: + Class: fab fa-twitter fa-fw # 004: Instagram instagram: - weight: 4 - prefix: https://www.instagram.com/ - title: Instagram - icon: - class: fab fa-instagram fa-fw + Weight: 4 + Prefix: https://www.instagram.com/ + Title: Instagram + Icon: + Class: fab fa-instagram fa-fw # 005: facebook facebook: - weight: 5 - prefix: https://facebook.com/ - title: facebook - icon: - class: fab fa-facebook fa-fw + Weight: 5 + Prefix: https://facebook.com/ + Title: facebook + Icon: + Class: fab fa-facebook fa-fw # 006: Telegram telegram: - weight: 6 - prefix: https://t.me/ - title: Telegram - icon: - class: fab fa-telegram-plane fa-fw + Weight: 6 + Prefix: https://t.me/ + Title: Telegram + Icon: + Class: fab fa-telegram-plane fa-fw # 007: Medium medium: - weight: 7 - prefix: https://medium.com/ - title: Medium - icon: - class: fab fa-medium fa-fw + Weight: 7 + Prefix: https://medium.com/ + Title: Medium + Icon: + Class: fab fa-medium fa-fw # 008: GitLab gitlab: - weight: 8 - prefix: https://gitlab.com/ - title: GitLab - icon: - class: fab fa-gitlab fa-fw + Weight: 8 + Prefix: https://gitlab.com/ + Title: GitLab + Icon: + Class: fab fa-gitlab fa-fw # 009: YouTube Legacy youtubelegacy: - weight: 9 - prefix: https://www.youtube.com/user/ - title: YouTube - icon: - class: fab fa-youtube fa-fw + Weight: 9 + Prefix: https://www.youtube.com/user/ + Title: YouTube + Icon: + Class: fab fa-youtube fa-fw # 010: YouTube Custom youtubecustom: - weight: 10 - prefix: https://www.youtube.com/c/ - title: YouTube - icon: - class: fab fa-youtube fa-fw + Weight: 10 + Prefix: https://www.youtube.com/c/ + Title: YouTube + Icon: + Class: fab fa-youtube fa-fw # 011: YouTube Channel youtubechannel: - weight: 11 - prefix: https://www.youtube.com/channel/ - title: YouTube - icon: - class: fab fa-youtube fa-fw + Weight: 11 + Prefix: https://www.youtube.com/channel/ + Title: YouTube + Icon: + Class: fab fa-youtube fa-fw # 012: Tumblr tumblr: - weight: 12 - template: https://%v.tumblr.com/ - title: Tumblr - icon: - class: fab fa-tumblr fa-fw + Weight: 12 + Template: https://%v.tumblr.com/ + Title: Tumblr + Icon: + Class: fab fa-tumblr fa-fw # 013: Quora quora: - weight: 13 - prefix: https://www.quora.com/profile/ - title: Quora - icon: - class: fab fa-quora fa-fw + Weight: 13 + Prefix: https://www.quora.com/profile/ + Title: Quora + Icon: + Class: fab fa-quora fa-fw # 014: Keybase keybase: - weight: 14 - prefix: https://keybase.io/ - title: Keybase - icon: - class: fab fa-keybase fa-fw + Weight: 14 + Prefix: https://keybase.io/ + Title: Keybase + Icon: + Class: fab fa-keybase fa-fw # 015: Pinterest pinterest: - weight: 15 - prefix: https://www.pinterest.com/ - title: Pinterest - icon: - class: fab fa-pinterest fa-fw + Weight: 15 + Prefix: https://www.pinterest.com/ + Title: Pinterest + Icon: + Class: fab fa-pinterest fa-fw # 016: Reddit reddit: - weight: 16 - prefix: https://www.reddit.com/user/ - title: Reddit - icon: - class: fab fa-reddit fa-fw + Weight: 16 + Prefix: https://www.reddit.com/user/ + Title: Reddit + Icon: + Class: fab fa-reddit fa-fw # 017: CodePen codepen: - weight: 17 - prefix: https://codepen.io/ - title: CodePen - icon: - class: fab fa-codepen fa-fw + Weight: 17 + Prefix: https://codepen.io/ + Title: CodePen + Icon: + Class: fab fa-codepen fa-fw # 018: freeCodeCamp freecodecamp: - weight: 18 - prefix: https://freecodecamp.org/ - title: freeCodeCamp - icon: - class: fab fa-free-code-camp fa-fw + Weight: 18 + Prefix: https://freecodecamp.org/ + Title: freeCodeCamp + Icon: + Class: fab fa-free-code-camp fa-fw # 019: Bitbucket bitbucket: - weight: 19 - prefix: https://bitbucket.org/ - title: Bitbucket - icon: - class: fab fa-bitbucket fa-fw + Weight: 19 + Prefix: https://bitbucket.org/ + Title: Bitbucket + Icon: + Class: fab fa-bitbucket fa-fw # 020: Stack Overflow stackoverflow: - weight: 20 - prefix: https://stackoverflow.com/users/ - title: Stack Overflow - icon: - class: fab fa-codepen fa-fw + Weight: 20 + Prefix: https://stackoverflow.com/users/ + Title: Stack Overflow + Icon: + Class: fab fa-codepen fa-fw # 021: 微博 weibo: - weight: 21 - prefix: https://weibo.com/ - title: 微博 - icon: - class: fab fa-weibo fa-fw + Weight: 21 + Prefix: https://weibo.com/ + Title: 微博 + Icon: + Class: fab fa-weibo fa-fw # 022: OK.RU odnoklassniki: - weight: 22 - prefix: https://ok.ru/ - title: OK.RU - icon: - class: fab fa-odnoklassniki fa-fw + Weight: 22 + Prefix: https://ok.ru/ + Title: OK.RU + Icon: + Class: fab fa-odnoklassniki fa-fw # 023: VK vk: - weight: 23 - prefix: https://vk.com/ - title: VK - icon: - class: fab fa-vk fa-fw + Weight: 23 + Prefix: https://vk.com/ + Title: VK + Icon: + Class: fab fa-vk fa-fw # 024: Flickr flickr: - weight: 24 - prefix: https://www.flickr.com/photos/ - title: Flickr - icon: - class: fab fa-flickr fa-fw + Weight: 24 + Prefix: https://www.flickr.com/photos/ + Title: Flickr + Icon: + Class: fab fa-flickr fa-fw # 025: Xing xing: - weight: 25 - prefix: https://www.xing.com/profile/ - title: Xing - icon: - class: fab fa-xing fa-fw + Weight: 25 + Prefix: https://www.xing.com/profile/ + Title: Xing + Icon: + Class: fab fa-xing fa-fw # 026: Snapchat snapchat: - weight: 26 - prefix: https://www.snapchat.com/add/ - title: Snapchat - icon: - class: fab fa-snapchat fa-fw + Weight: 26 + Prefix: https://www.snapchat.com/add/ + Title: Snapchat + Icon: + Class: fab fa-snapchat fa-fw # 027: SoundCloud soundcloud: - weight: 27 - prefix: https://soundcloud.com/ - title: SoundCloud - icon: - class: fab fa-soundcloud fa-fw + Weight: 27 + Prefix: https://soundcloud.com/ + Title: SoundCloud + Icon: + Class: fab fa-soundcloud fa-fw # 028: Spotify spotify: - weight: 28 - prefix: https://open.spotify.com/user/ - title: Spotify - icon: - class: fab fa-spotify fa-fw + Weight: 28 + Prefix: https://open.spotify.com/user/ + Title: Spotify + Icon: + Class: fab fa-spotify fa-fw # 029: Bandcamp bandcamp: - weight: 29 - template: https://%v.bandcamp.com/ - title: Bandcamp - icon: - class: fab fa-bandcamp fa-fw + Weight: 29 + Template: https://%v.bandcamp.com/ + Title: Bandcamp + Icon: + Class: fab fa-bandcamp fa-fw # 030: PayPal paypal: - weight: 30 - prefix: https://paypal.me/ - title: PayPal - icon: - class: fab fa-paypal fa-fw + Weight: 30 + Prefix: https://paypal.me/ + Title: PayPal + Icon: + Class: fab fa-paypal fa-fw # 031: 500px fivehundredpx: - weight: 31 - prefix: https://500px.com/ - title: 500px - icon: - class: fab fa-500px fa-fw + Weight: 31 + Prefix: https://500px.com/ + Title: 500px + Icon: + Class: fab fa-500px fa-fw # 032: Mix mix: - weight: 32 - prefix: https://mix.com/ - title: Mix - icon: - class: fab fa-mix fa-fw + Weight: 32 + Prefix: https://mix.com/ + Title: Mix + Icon: + Class: fab fa-mix fa-fw # 033: Goodreads goodreads: - weight: 33 - prefix: https://www.goodreads.com/user/show/ - title: Goodreads - icon: - class: fab fa-goodreads fa-fw + Weight: 33 + Prefix: https://www.goodreads.com/user/show/ + Title: Goodreads + Icon: + Class: fab fa-goodreads fa-fw # 034: Last.fm lastfm: - weight: 34 - prefix: https://www.last.fm/user/ - title: Last.fm - icon: - class: fab fa-lastfm fa-fw + Weight: 34 + Prefix: https://www.last.fm/user/ + Title: Last.fm + Icon: + Class: fab fa-lastfm fa-fw # 035: Foursquare foursquare: - weight: 35 - prefix: https://foursquare.com/ - title: Foursquare - icon: - class: fab fa-foursquare fa-fw + Weight: 35 + Prefix: https://foursquare.com/ + Title: Foursquare + Icon: + Class: fab fa-foursquare fa-fw # 036: Hacker News hackernews: - weight: 36 - template: https://news.ycombinator.com/user?id=%v - title: Hacker News - icon: - class: fab fa-hacker-news fa-fw + Weight: 36 + Template: https://news.ycombinator.com/user?id=%v + Title: Hacker News + Icon: + Class: fab fa-hacker-news fa-fw # 037: Kickstarter kickstarter: - weight: 37 - prefix: https://kickstarter.com/profile/ - title: Kickstarter - icon: - class: fab fa-kickstarter fa-fw + Weight: 37 + Prefix: https://kickstarter.com/profile/ + Title: Kickstarter + Icon: + Class: fab fa-kickstarter fa-fw # 038: Patreon patreon: - weight: 38 - prefix: https://patreon.com/ - title: Patreon - icon: - class: fab fa-patreon fa-fw + Weight: 38 + Prefix: https://patreon.com/ + Title: Patreon + Icon: + Class: fab fa-patreon fa-fw # 039: Steam steam: - weight: 39 - prefix: https://steamcommunity.com/id/ - title: Steam - icon: - class: fab fa-steam fa-fw + Weight: 39 + Prefix: https://steamcommunity.com/id/ + Title: Steam + Icon: + Class: fab fa-steam fa-fw # 040: Twitch twitch: - weight: 40 - prefix: https://www.twitch.tv/ - title: Twitch - icon: - class: fab fa-twitch fa-fw + Weight: 40 + Prefix: https://www.twitch.tv/ + Title: Twitch + Icon: + Class: fab fa-twitch fa-fw # 041: Strava strava: - weight: 41 - prefix: https://www.strava.com/athletes/ - title: Strava - icon: - class: fab fa-strava fa-fw + Weight: 41 + Prefix: https://www.strava.com/athletes/ + Title: Strava + Icon: + Class: fab fa-strava fa-fw # 042: Skype skype: - weight: 42 - template: "skype:" - title: Skype - icon: - class: fab fa-skype fa-fw + Weight: 42 + Template: "skype:" + Title: Skype + Icon: + Class: fab fa-skype fa-fw # 043: WhatsApp whatsapp: - weight: 43 - prefix: https://wa.me/ - title: WhatsApp - icon: - class: fab fa-whatsapp fa-fw + Weight: 43 + Prefix: https://wa.me/ + Title: WhatsApp + Icon: + Class: fab fa-whatsapp fa-fw # 044: 知乎 zhihu: - weight: 44 - prefix: https://www.zhihu.com/people/ - title: 知乎 - icon: - simpleicons: zhihu + Weight: 44 + Prefix: https://www.zhihu.com/people/ + Title: 知乎 + Icon: + Simpleicons: zhihu # 045: 豆瓣 douban: - weight: 45 - prefix: https://www.douban.com/people/ - title: 豆瓣 - icon: - simpleicons: douban + Weight: 45 + Prefix: https://www.douban.com/people/ + Title: 豆瓣 + Icon: + Simpleicons: douban # 046: Angellist angellist: - weight: 46 - prefix: https://angel.co/ - title: Angellist - icon: - class: fab fa-angellist fa-fw + Weight: 46 + Prefix: https://angel.co/ + Title: Angellist + Icon: + Class: fab fa-angellist fa-fw # 047: SlideShare slideshare: - weight: 47 - prefix: https://slideshare.com/ - title: SlideShare - icon: - class: fab fa-slideshare fa-fw + Weight: 47 + Prefix: https://slideshare.com/ + Title: SlideShare + Icon: + Class: fab fa-slideshare fa-fw # 048: JSFiddle jsfiddle: - weight: 48 - prefix: https://jsfiddle.com/ - title: JSFiddle - icon: - class: fab fa-jsfiddle fa-fw + Weight: 48 + Prefix: https://jsfiddle.com/ + Title: JSFiddle + Icon: + Class: fab fa-jsfiddle fa-fw # 049: DeviantArt deviantart: - weight: 49 - template: https://%v.deviantart.com/ - title: DeviantArt - icon: - class: fab fa-deviantart fa-fw + Weight: 49 + Template: https://%v.deviantart.com/ + Title: DeviantArt + Icon: + Class: fab fa-deviantart fa-fw # 050: Behance behance: - weight: 50 - prefix: https://behance.net/ - title: Behance - icon: - class: fab fa-behance fa-fw + Weight: 50 + Prefix: https://behance.net/ + Title: Behance + Icon: + Class: fab fa-behance fa-fw # 051: Dribbble dribbble: - weight: 51 - prefix: https://dribbble.com/ - title: Dribbble - icon: - class: fab fa-dribbble fa-fw + Weight: 51 + Prefix: https://dribbble.com/ + Title: Dribbble + Icon: + Class: fab fa-dribbble fa-fw # 052: WordPress wordpress: - weight: 52 - template: https://%v.wordpress.com/ - title: WordPress - icon: - class: fab fa-wordpress fa-fw + Weight: 52 + Template: https://%v.wordpress.com/ + Title: WordPress + Icon: + Class: fab fa-wordpress fa-fw # 053: Vine vine: - weight: 53 - prefix: https://vine.co/ - title: Vine - icon: - class: fab fa-vine fa-fw + Weight: 53 + Prefix: https://vine.co/ + Title: Vine + Icon: + Class: fab fa-vine fa-fw # 054: Google Scholar googlescholar: - weight: 54 - template: https://scholar.google.com/citations?%v - title: Google Scholar - icon: - simpleicons: googlescholar + Weight: 54 + Template: https://scholar.google.com/citations?%v + Title: Google Scholar + Icon: + Simpleicons: googlescholar # 055: ResearchGate researchgate: - weight: 55 - prefix: https://www.researchgate.net/profile/ - title: ResearchGate - icon: - class: fab fa-researchgate fa-fw + Weight: 55 + Prefix: https://www.researchgate.net/profile/ + Title: ResearchGate + Icon: + Class: fab fa-researchgate fa-fw # 056: Mastodon mastodon: - weight: 56 - prefix: https://mastodon.social/ - title: Mastodon - icon: - class: fab fa-mastodon fa-fw + Weight: 56 + Prefix: https://mastodon.social/ + Title: Mastodon + Icon: + Class: fab fa-mastodon fa-fw # 057: Thingiverse thingiverse: - weight: 57 - prefix: https://www.thingiverse.com/ - title: Thingiverse - icon: - src: svg/icons/thingiverse.svg + Weight: 57 + Prefix: https://www.thingiverse.com/ + Title: Thingiverse + Icon: + Src: svg/icons/thingiverse.svg # 058: Dev.To devto: - weight: 58 - prefix: https://dev.to/ - title: Dev.To - icon: - class: fab fa-dev fa-fw + Weight: 58 + Prefix: https://dev.to/ + Title: Dev.To + Icon: + Class: fab fa-dev fa-fw # 059: Gitea gitea: - weight: 59 - title: Gitea - icon: - simpleicons: gitea + Weight: 59 + Title: Gitea + Icon: + Simpleicons: gitea # 060: XMPP xmpp: - weight: 60 - template: xmpp:%v - title: XMPP - icon: - simpleicons: xmpp + Weight: 60 + Template: xmpp:%v + Title: XMPP + Icon: + Simpleicons: xmpp # 061: Matrix matrix: - weight: 61 - prefix: https://matrix.to/#/ - title: Matrix - icon: - simpleicons: matrix + Weight: 61 + Prefix: https://matrix.to/#/ + Title: Matrix + Icon: + Simpleicons: matrix # 062: bilibili bilibili: - weight: 62 - prefix: https://space.bilibili.com/ - title: bilibili - icon: - src: svg/icons/bilibili.svg + Weight: 62 + Prefix: https://space.bilibili.com/ + Title: bilibili + Icon: + Src: svg/icons/bilibili.svg # 063: Email email: - weight: 63 - template: mailto:%v - title: Email - icon: - class: far fa-envelope fa-fw + Weight: 63 + Template: mailto:%v + Title: Email + Icon: + Class: far fa-envelope fa-fw # 064: RSS rss: - weight: 64 - url: /index.xml - title: RSS - newtab: true - icon: - class: fas fa-rss fa-fw + Weight: 64 + Url: /index.xml + Title: RSS + Newtab: true + Icon: + Class: fas fa-rss fa-fw diff --git a/assets/svg/loading.svg b/assets/svg/loading.svg new file mode 100644 index 0000000..02a0eee --- /dev/null +++ b/assets/svg/loading.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/assets/svg/loading/normal.svg b/assets/svg/loading/normal.svg deleted file mode 100644 index b852575..0000000 --- a/assets/svg/loading/normal.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/assets/svg/loading/small.svg b/assets/svg/loading/small.svg deleted file mode 100644 index f406250..0000000 --- a/assets/svg/loading/small.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/exampleSite/static/images/Apple-Devices-Preview.png b/exampleSite/content/about/Apple-Devices-Preview.png similarity index 100% rename from exampleSite/static/images/Apple-Devices-Preview.png rename to exampleSite/content/about/Apple-Devices-Preview.png diff --git a/exampleSite/content/about/index.en.md b/exampleSite/content/about/index.en.md index 6d4b15f..25056e6 100644 --- a/exampleSite/content/about/index.en.md +++ b/exampleSite/content/about/index.en.md @@ -21,7 +21,7 @@ math: > > It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt) and [KeepIt Theme](https://github.com/Fastbyte01/KeepIt). -![Hugo Theme LoveIt](/images/Apple-Devices-Preview.png "Hugo Theme LoveIt") +![Hugo Theme LoveIt](Apple-Devices-Preview.png "Hugo Theme LoveIt") ### Features diff --git a/exampleSite/content/about/index.fr.md b/exampleSite/content/about/index.fr.md index 58013fe..e512274 100644 --- a/exampleSite/content/about/index.fr.md +++ b/exampleSite/content/about/index.fr.md @@ -26,7 +26,7 @@ Welcome to take the time to propose a translation by [:(fas fa-code-branch fa-fw > > It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt) and [KeepIt Theme](https://github.com/Fastbyte01/KeepIt). -![Hugo Theme LoveIt](/images/Apple-Devices-Preview.png "Hugo Theme LoveIt") +![Hugo Theme LoveIt](Apple-Devices-Preview.png "Hugo Theme LoveIt") ### Features diff --git a/exampleSite/content/about/index.zh-cn.md b/exampleSite/content/about/index.zh-cn.md index 6a830a6..9cbe604 100644 --- a/exampleSite/content/about/index.zh-cn.md +++ b/exampleSite/content/about/index.zh-cn.md @@ -21,7 +21,7 @@ math: > > 它的原型基于 [LeaveIt 主题](https://github.com/liuzc/LeaveIt) 和 [KeepIt 主题](https://github.com/Fastbyte01/KeepIt)。 -![Hugo 主题 LoveIt](/images/Apple-Devices-Preview.png "Hugo 主题 LoveIt") +![Hugo 主题 LoveIt](Apple-Devices-Preview.png "Hugo 主题 LoveIt") ### 特性 diff --git a/exampleSite/static/images/basic-markdown-syntax/featured-image.png b/exampleSite/content/posts/basic-markdown-syntax/featured-image.png similarity index 100% rename from exampleSite/static/images/basic-markdown-syntax/featured-image.png rename to exampleSite/content/posts/basic-markdown-syntax/featured-image.png diff --git a/exampleSite/content/posts/basic-markdown-syntax/index.en.md b/exampleSite/content/posts/basic-markdown-syntax/index.en.md index 99a6c53..cdbaf8f 100644 --- a/exampleSite/content/posts/basic-markdown-syntax/index.en.md +++ b/exampleSite/content/posts/basic-markdown-syntax/index.en.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "This article shows the basic Markdown syntax and format." -images: ["/images/basic-markdown-syntax/featured-image.png"] +resources: +- name: "featured-image" + src: "featured-image.png" tags: ["Markdown", "HTML"] categories: ["Markdown"] -featuredImage: "/images/basic-markdown-syntax/featured-image.png" lightgallery: true --- diff --git a/exampleSite/content/posts/basic-markdown-syntax/index.fr.md b/exampleSite/content/posts/basic-markdown-syntax/index.fr.md index 2539bed..0d30743 100644 --- a/exampleSite/content/posts/basic-markdown-syntax/index.fr.md +++ b/exampleSite/content/posts/basic-markdown-syntax/index.fr.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "Cet article présente la syntaxe et le format de base de Markdown." -images: ["/images/basic-markdown-syntax/featured-image.png"] +resources: +- name: "featured-image" + src: "featured-image.png" tags: ["Markdown", "HTML"] categories: ["Markdown"] -featuredImage: "/images/basic-markdown-syntax/featured-image.png" lightgallery: true --- diff --git a/exampleSite/content/posts/basic-markdown-syntax/index.zh-cn.md b/exampleSite/content/posts/basic-markdown-syntax/index.zh-cn.md index 70f42b7..ec8f6b1 100644 --- a/exampleSite/content/posts/basic-markdown-syntax/index.zh-cn.md +++ b/exampleSite/content/posts/basic-markdown-syntax/index.zh-cn.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "这篇文章展示了基本的 Markdown 语法和格式." -images: ["/images/basic-markdown-syntax/featured-image.png"] +resources: +- name: "featured-image" + src: "featured-image.png" tags: ["Markdown", "HTML"] categories: ["Markdown"] -featuredImage: "/images/basic-markdown-syntax/featured-image.png" lightgallery: true --- diff --git a/exampleSite/static/images/emoji-support/featured-image.jpg b/exampleSite/content/posts/emoji-support/featured-image.jpg similarity index 100% rename from exampleSite/static/images/emoji-support/featured-image.jpg rename to exampleSite/content/posts/emoji-support/featured-image.jpg diff --git a/exampleSite/content/posts/emoji-support/index.en.md b/exampleSite/content/posts/emoji-support/index.en.md index 8e4f6a4..869d94a 100644 --- a/exampleSite/content/posts/emoji-support/index.en.md +++ b/exampleSite/content/posts/emoji-support/index.en.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "Guide to emoji usage in Hugo and LoveIt." -images: ["/images/emoji-support/featured-image.jpg"] +resources: +- name: "featured-image" + src: "featured-image.jpg" tags: ["emoji"] categories: ["Markdown"] -featuredImage: "/images/emoji-support/featured-image.jpg" lightgallery: true --- diff --git a/exampleSite/content/posts/emoji-support/index.fr.md b/exampleSite/content/posts/emoji-support/index.fr.md index cc95938..d084981 100644 --- a/exampleSite/content/posts/emoji-support/index.fr.md +++ b/exampleSite/content/posts/emoji-support/index.fr.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "Guide d'utilisation des emoji dans Hugo et LoveIt." -images: ["/images/emoji-support/featured-image.jpg"] +resources: +- name: "featured-image" + src: "featured-image.jpg" tags: ["emoji"] categories: ["Markdown"] -featuredImage: "/images/emoji-support/featured-image.jpg" lightgallery: true --- diff --git a/exampleSite/content/posts/emoji-support/index.zh-cn.md b/exampleSite/content/posts/emoji-support/index.zh-cn.md index 2411987..1bd5700 100644 --- a/exampleSite/content/posts/emoji-support/index.zh-cn.md +++ b/exampleSite/content/posts/emoji-support/index.zh-cn.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "Hugo 和 LoveIt 中的 Emoji 的用法指南." -images: ["/images/emoji-support/featured-image.jpg"] +resources: +- name: "featured-image" + src: "featured-image.jpg" tags: ["emoji"] categories: ["Markdown"] -featuredImage: "/images/emoji-support/featured-image.jpg" lightgallery: true --- diff --git a/exampleSite/static/images/theme-documentation-basics/basic-configuration-preview.png b/exampleSite/content/posts/theme-documentation-basics/basic-configuration-preview.png similarity index 100% rename from exampleSite/static/images/theme-documentation-basics/basic-configuration-preview.png rename to exampleSite/content/posts/theme-documentation-basics/basic-configuration-preview.png diff --git a/exampleSite/static/images/theme-documentation-basics/basic-configuration-preview.zh-cn.png b/exampleSite/content/posts/theme-documentation-basics/basic-configuration-preview.zh-cn.png similarity index 100% rename from exampleSite/static/images/theme-documentation-basics/basic-configuration-preview.zh-cn.png rename to exampleSite/content/posts/theme-documentation-basics/basic-configuration-preview.zh-cn.png diff --git a/exampleSite/static/images/theme-documentation-basics/complete-configuration-preview.png b/exampleSite/content/posts/theme-documentation-basics/complete-configuration-preview.png similarity index 100% rename from exampleSite/static/images/theme-documentation-basics/complete-configuration-preview.png rename to exampleSite/content/posts/theme-documentation-basics/complete-configuration-preview.png diff --git a/exampleSite/static/images/theme-documentation-basics/complete-configuration-preview.zh-cn.png b/exampleSite/content/posts/theme-documentation-basics/complete-configuration-preview.zh-cn.png similarity index 100% rename from exampleSite/static/images/theme-documentation-basics/complete-configuration-preview.zh-cn.png rename to exampleSite/content/posts/theme-documentation-basics/complete-configuration-preview.zh-cn.png diff --git a/exampleSite/static/images/theme-documentation-basics/featured-image.jpg b/exampleSite/content/posts/theme-documentation-basics/featured-image.jpg similarity index 100% rename from exampleSite/static/images/theme-documentation-basics/featured-image.jpg rename to exampleSite/content/posts/theme-documentation-basics/featured-image.jpg diff --git a/exampleSite/content/posts/theme-documentation-basics/index.en.md b/exampleSite/content/posts/theme-documentation-basics/index.en.md index 3be2a10..2a405dc 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.en.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.en.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "Discover what the Hugo - LoveIt theme is all about and the core-concepts behind it." -images: ["/images/theme-documentation-basics/featured-image.jpg"] +resources: +- name: "featured-image" + src: "featured-image.jpg" tags: ["installation", "configuration"] categories: ["documentation"] -featuredImage: "/images/theme-documentation-basics/featured-image.jpg" lightgallery: true @@ -153,7 +154,7 @@ hugo serve Go to `http://localhost:1313`. -![Basic configuration preview](/images/theme-documentation-basics/basic-configuration-preview.png "Basic configuration preview") +![Basic configuration preview](basic-configuration-preview.png "Basic configuration preview") {{< admonition tip >}} When you run `hugo serve`, when the contents of the files change, the page automatically refreshes with the changes. @@ -785,7 +786,7 @@ The default data of all supported social links is located in `themes/LoveIt/asse which is you can refer to. {{< /admonition >}} -![Complete configuration preview](/images/theme-documentation-basics/complete-configuration-preview.png "Complete configuration preview") +![Complete configuration preview](complete-configuration-preview.png "Complete configuration preview") ### 3.2 Favicons, Browserconfig, Manifest @@ -833,7 +834,7 @@ In `assets/css/_custom.scss`, you can add some css style code to customize the s **LoveIt** theme is fully compatible with Hugo multilingual mode, which provides in-browser language switching. -![Language Switch](/images/theme-documentation-basics/language-switch.gif "Language Switch") +![Language Switch](language-switch.gif "Language Switch") ### 4.1 Compatibility {#language-compatibility} diff --git a/exampleSite/content/posts/theme-documentation-basics/index.fr.md b/exampleSite/content/posts/theme-documentation-basics/index.fr.md index 7d11ad1..2adc50f 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.fr.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.fr.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "Découvrez en quoi consiste le thème Hugo - LoveIt et les concepts fondamentaux qui le sous-tendent." -images: ["/images/theme-documentation-basics/featured-image.jpg"] +resources: +- name: "featured-image" + src: "featured-image.jpg" tags: ["installation", "configuration"] categories: ["documentation"] -featuredImage: "/images/theme-documentation-basics/featured-image.jpg" lightgallery: true @@ -158,7 +159,7 @@ hugo serve Go to `http://localhost:1313`. -![Basic configuration preview](/images/theme-documentation-basics/basic-configuration-preview.png "Basic configuration preview") +![Basic configuration preview](basic-configuration-preview.png "Basic configuration preview") {{< admonition tip >}} When you run `hugo serve`, when the contents of the files change, the page automatically refreshes with the changes. @@ -790,7 +791,7 @@ The default data of all supported social links is located in `themes/LoveIt/asse which is you can refer to. {{< /admonition >}} -![Complete configuration preview](/images/theme-documentation-basics/complete-configuration-preview.png "Complete configuration preview") +![Complete configuration preview](complete-configuration-preview.png "Complete configuration preview") ### 3.2 Favicons, Browserconfig, Manifest @@ -838,7 +839,7 @@ In `assets/css/_custom.scss`, you can add some css style code to customize the s **LoveIt** theme is fully compatible with Hugo multilingual mode, which provides in-browser language switching. -![Language Switch](/images/theme-documentation-basics/language-switch.gif "Language Switch") +![Language Switch](language-switch.gif "Language Switch") ### 4.1 Compatibility {#language-compatibility} diff --git a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md index 3013bcc..8cbc5ad 100644 --- a/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-basics/index.zh-cn.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "探索 Hugo - LoveIt 主题的全部内容和背后的核心概念." -images: ["/images/theme-documentation-basics/featured-image.jpg"] +resources: +- name: "featured-image" + src: "featured-image.jpg" tags: ["installation", "configuration"] categories: ["documentation"] -featuredImage: "/images/theme-documentation-basics/featured-image.jpg" lightgallery: true @@ -156,7 +157,7 @@ hugo serve 去查看 `http://localhost:1313`. -![基本配置下的预览](/images/theme-documentation-basics/basic-configuration-preview.zh-cn.png "基本配置下的预览") +![基本配置下的预览](basic-configuration-preview.zh-cn.png "基本配置下的预览") {{< admonition tip >}} 当你运行 `hugo serve` 时, 当文件内容更改时, 页面会随着更改自动刷新. @@ -789,7 +790,7 @@ hugo 你可以参考它来配置你的社交链接. {{< /admonition >}} -![完整配置下的预览](/images/theme-documentation-basics/complete-configuration-preview.zh-cn.png "完整配置下的预览") +![完整配置下的预览](complete-configuration-preview.zh-cn.png "完整配置下的预览") ### 3.2 网站图标, 浏览器配置, 网站清单 @@ -837,7 +838,7 @@ $code-font-family: Fira Mono, Source Code Pro, Menlo, Consolas, Monaco, monospac **LoveIt** 主题完全兼容 Hugo 的多语言模式, 并且支持在网页上切换语言. -![语言切换](/images/theme-documentation-basics/language-switch.gif "语言切换") +![语言切换](language-switch.gif "语言切换") ### 4.1 兼容性 {#language-compatibility} diff --git a/exampleSite/static/images/theme-documentation-basics/language-switch.gif b/exampleSite/content/posts/theme-documentation-basics/language-switch.gif similarity index 100% rename from exampleSite/static/images/theme-documentation-basics/language-switch.gif rename to exampleSite/content/posts/theme-documentation-basics/language-switch.gif diff --git a/exampleSite/static/images/theme-documentation-built-in-shortcodes/featured-image.png b/exampleSite/content/posts/theme-documentation-built-in-shortcodes/featured-image.png similarity index 100% rename from exampleSite/static/images/theme-documentation-built-in-shortcodes/featured-image.png rename to exampleSite/content/posts/theme-documentation-built-in-shortcodes/featured-image.png diff --git a/exampleSite/content/posts/theme-documentation-built-in-shortcodes/index.en.md b/exampleSite/content/posts/theme-documentation-built-in-shortcodes/index.en.md index 9eebc10..9ddabed 100644 --- a/exampleSite/content/posts/theme-documentation-built-in-shortcodes/index.en.md +++ b/exampleSite/content/posts/theme-documentation-built-in-shortcodes/index.en.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "Hugo provides multiple built-in shortcodes for author convenience and to keep your markdown content clean." -images: ["/images/theme-documentation-built-in-shortcodes/featured-image.png"] +resources: +- name: "featured-image" + src: "featured-image.png" tags: ["shortcodes"] categories: ["documentation"] -featuredImage: "/images/theme-documentation-built-in-shortcodes/featured-image.png" lightgallery: true --- @@ -36,18 +37,18 @@ Hugo ships with a set of predefined shortcodes that represent very common usage. Example `figure` input: ```markdown -{{}} +{{}} ``` The rendered output looks like this: -{{< figure src="/images/theme-documentation-built-in-shortcodes/lighthouse.jpg" title="Lighthouse (figure)" >}} +{{< figure src="/images/lighthouse.jpg" title="Lighthouse (figure)" >}} The HTML looks like this: ```html
- +

Lighthouse (figure)

diff --git a/exampleSite/content/posts/theme-documentation-built-in-shortcodes/index.fr.md b/exampleSite/content/posts/theme-documentation-built-in-shortcodes/index.fr.md index 0978d1c..fdb0bb1 100644 --- a/exampleSite/content/posts/theme-documentation-built-in-shortcodes/index.fr.md +++ b/exampleSite/content/posts/theme-documentation-built-in-shortcodes/index.fr.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "Hugo fournit plusieurs shortcodes intégrés pour la commodité de l'auteur et pour garder votre contenu de démarque propre." -images: ["/images/theme-documentation-built-in-shortcodes/featured-image.png"] +resources: +- name: "featured" + src: "featured-image.png" tags: ["shortcodes"] categories: ["documentation"] -featuredImage: "/images/theme-documentation-built-in-shortcodes/featured-image.png" lightgallery: true --- @@ -41,18 +42,18 @@ Hugo ships with a set of predefined shortcodes that represent very common usage. Example `figure` input: ```markdown -{{}} +{{}} ``` The rendered output looks like this: -{{< figure src="/images/theme-documentation-built-in-shortcodes/lighthouse.jpg" title="Lighthouse (figure)" >}} +{{< figure src="/images/lighthouse.jpg" title="Lighthouse (figure)" >}} The HTML looks like this: ```html
- +

Lighthouse (figure)

diff --git a/exampleSite/content/posts/theme-documentation-built-in-shortcodes/index.zh-cn.md b/exampleSite/content/posts/theme-documentation-built-in-shortcodes/index.zh-cn.md index 5369257..66d275a 100644 --- a/exampleSite/content/posts/theme-documentation-built-in-shortcodes/index.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-built-in-shortcodes/index.zh-cn.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "Hugo 提供了多个内置的 Shortcodes, 以方便作者保持 Markdown 内容的整洁." -images: ["/images/theme-documentation-built-in-shortcodes/featured-image.png"] +resources: +- name: "featured-image" + src: "featured-image.png" tags: ["shortcodes"] categories: ["documentation"] -featuredImage: "/images/theme-documentation-built-in-shortcodes/featured-image.png" lightgallery: true --- @@ -37,18 +38,18 @@ Hugo 附带了一组预定义的 shortcodes, 它们实现了一些非常常见 一个 `figure` 示例: ```markdown -{{}} +{{}} ``` 呈现的输出效果如下: -{{< figure src="/images/theme-documentation-built-in-shortcodes/lighthouse.jpg" title="Lighthouse (figure)" >}} +{{< figure src="/images/lighthouse.jpg" title="Lighthouse (figure)" >}} 输出的 HTML 看起来像这样: ```html
- +

Lighthouse (figure)

diff --git a/exampleSite/static/images/theme-documentation-content/featured-image.jpg b/exampleSite/content/posts/theme-documentation-content/featured-image.jpg similarity index 100% rename from exampleSite/static/images/theme-documentation-content/featured-image.jpg rename to exampleSite/content/posts/theme-documentation-content/featured-image.jpg diff --git a/exampleSite/content/posts/theme-documentation-content/index.en.md b/exampleSite/content/posts/theme-documentation-content/index.en.md index 6783fc7..e2a1f11 100644 --- a/exampleSite/content/posts/theme-documentation-content/index.en.md +++ b/exampleSite/content/posts/theme-documentation-content/index.en.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "Find out how to create and organize your content quickly and intuitively in LoveIt theme." -images: ["/images/theme-documentation-content/featured-image.jpg"] +resources: +- name: "featured-image" + src: "featured-image.jpg" tags: ["content", "Markdown"] categories: ["documentation"] -featuredImage: "/images/theme-documentation-content/featured-image.jpg" lightgallery: true @@ -25,13 +26,35 @@ Find out how to create and organize your content quickly and intuitively in **Lo -## 1 Contents Organization +## 1 Contents Organization {#contents-organization} A few suggestions to help you get a good looking site quickly: * Keep post pages in the `content/posts` directory, for example: `content/posts/my-first-post.md` -* Keep static pages in the `content` directory, for example: `content/about.md` -* Keep media like images in the `static` directory, for example: `static/images/screenshot.png` +* Keep other pages in the `content` directory, for example: `content/about.md` +* Local resources organization + +{{< admonition note "Local Resource Reference" >}} +{{< version 0.2.10 >}} + +There are three ways to reference local resources such as **images** and **music**: + +1. Using [page resources](https://gohugo.io/content-management/page-resources/) in [page bundles](https://gohugo.io/content-management/page-bundles/). + You can reference page resources by the value for `Resources.GetMatch` or the filepath of the resource relative to the page directory directly. +2. Store resources in the **assets** directory, which is `/assets` by default. + The filepath of the resource to reference in the post is relative to the assets directory. +3. Store resources in the **static** directory, which is `/static` by default. + The filepath of the resource to reference in the post is relative to the static directory. + +The **priority** of references is also in the above order. + +There are many places in the theme where the above local resource references can be used, +such as **links**, **images**, `image` shortcode, `music` shortcode and some params in the **front matter**. + +Images in page resources or assets directory [processing](https://gohugo.io/content-management/image-processing/) +will be supported in the future. +It's really cool! :(far fa-grin-squint fa-fw): +{{< /admonition >}} ## 2 Front Matter {#front-matter} @@ -138,11 +161,28 @@ library: * **comment**: {{< version 0.2.0 changed >}} the same as the `params.page.comment` part in the [site configuration](../theme-documentation-basics#site-configuration). * **library**: {{< version 0.2.7 >}} the same as the `params.page.library` part in the [site configuration](../theme-documentation-basics#site-configuration). +{{< admonition tip >}} +{{< version 0.2.10 >}} + +**featuredImage** and **featuredImagePreview** support the complete usage of [local resource references](#contents-organization). + +If the page resource with `name: featured-image` or `name: featured-image-preview` is set in the front matter, +it is not necessary to set the parameter `featuredImage` or `featuredImagePreview`: + +```yaml +resources: +- name: featured-image + src: featured-image.jpg +- name: featured-image-preview + src: featured-image-preview.jpg +``` +{{< /admonition >}} + ## 3 Content Summaries **LoveIt** theme uses the summary of the content to display abstract information in the home page. Hugo can generate summaries of your content. -![Summary Preview](/images/theme-documentation-content/summary.png "Summary Preview") +![Summary Preview](summary.png "Summary Preview") ### Automatic Summary Splitting diff --git a/exampleSite/content/posts/theme-documentation-content/index.fr.md b/exampleSite/content/posts/theme-documentation-content/index.fr.md index 9126cea..9703861 100644 --- a/exampleSite/content/posts/theme-documentation-content/index.fr.md +++ b/exampleSite/content/posts/theme-documentation-content/index.fr.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "Découvrez comment créer et organiser votre contenu rapidement et intuitivement dans le thème LoveIt." -images: ["/images/theme-documentation-content/featured-image.jpg"] +resources: +- name: "featured-image" + src: "featured-image.jpg" tags: ["content", "Markdown"] categories: ["documentation"] -featuredImage: "/images/theme-documentation-content/featured-image.jpg" lightgallery: true @@ -30,13 +31,35 @@ Sorry, this article has not been completely translated into **French**. Welcome to take the time to propose a translation by [:(fas fa-code-branch fa-fw): making a PR](https://github.com/dillonzq/LoveIt/pulls) to the theme! {{< /admonition >}} -## 1 Contents Organization +## 1 Contents Organization {#contents-organization} A few suggestions to help you get a good looking site quickly: * Keep post pages in the `content/posts` directory, for example: `content/posts/my-first-post.md` -* Keep static pages in the `content` directory, for example: `content/about.md` -* Keep media like images in the `static` directory, for example: `static/images/screenshot.png` +* Keep other pages in the `content` directory, for example: `content/about.md` +* Local resources organization + +{{< admonition note "Local Resource Reference" >}} +{{< version 0.2.10 >}} + +There are three ways to reference local resources such as **images** and **music**: + +1. Using [page resources](https://gohugo.io/content-management/page-resources/) in [page bundles](https://gohugo.io/content-management/page-bundles/). + You can reference page resources by the value for `Resources.GetMatch` or the filepath of the resource relative to the page directory directly. +2. Store resources in the **assets** directory, which is `/assets` by default. + The filepath of the resource to reference in the post is relative to the assets directory. +3. Store resources in the **static** directory, which is `/static` by default. + The filepath of the resource to reference in the post is relative to the static directory. + +The **priority** of references is also in the above order. + +There are many places in the theme where the above local resource references can be used, +such as **links**, **images**, `image` shortcode, `music` shortcode and some params in the **front matter**. + +Images in page resources or assets directory [processing](https://gohugo.io/content-management/image-processing/) +will be supported in the future. +It's really cool! :(far fa-grin-squint fa-fw): +{{< /admonition >}} ## 2 Front Matter {#front-matter} @@ -143,11 +166,28 @@ library: * **comment**: {{< version 0.2.0 changed >}} the same as the `params.page.comment` part in the [site configuration](../theme-documentation-basics#site-configuration). * **library**: {{< version 0.2.7 >}} the same as the `params.page.library` part in the [site configuration](../theme-documentation-basics#site-configuration). +{{< admonition tip >}} +{{< version 0.2.10 >}} + +**featuredImage** and **featuredImagePreview** support the complete usage of [local resource references](#contents-organization). + +If the page resource with `name: featured-image` or `name: featured-image-preview` is set in the front matter, +it is not necessary to set the parameter `featuredImage` or `featuredImagePreview`: + +```yaml +resources: +- name: featured-image + src: featured-image.jpg +- name: featured-image-preview + src: featured-image-preview.jpg +``` +{{< /admonition >}} + ## 3 Content Summaries **LoveIt** theme uses the summary of the content to display abstract information in the home page. Hugo can generate summaries of your content. -![Summary Preview](/images/theme-documentation-content/summary.png "Summary Preview") +![Summary Preview](summary.png "Summary Preview") ### Automatic Summary Splitting diff --git a/exampleSite/content/posts/theme-documentation-content/index.zh-cn.md b/exampleSite/content/posts/theme-documentation-content/index.zh-cn.md index ad8e630..2f4b997 100644 --- a/exampleSite/content/posts/theme-documentation-content/index.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-content/index.zh-cn.md @@ -7,11 +7,12 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "了解如何在 LoveIt 主题中快速, 直观地创建和组织内容." -images: ["/images/theme-documentation-content/featured-image.jpg"] +resources: +- name: "featured-image" + src: "featured-image.jpg" tags: ["content", "Markdown"] categories: ["documentation"] -featuredImage: "/images/theme-documentation-content/featured-image.jpg" lightgallery: true @@ -25,13 +26,34 @@ math: -## 1 内容组织 +## 1 内容组织 {#contents-organization} 以下是一些方便你清晰管理和生成文章的目录结构建议: * 保持博客文章存放在 `content/posts` 目录, 例如: `content/posts/我的第一篇文章.md` * 保持简单的静态页面存放在 `content` 目录, 例如: `content/about.md` -* 保持图片之类的媒体资源存放在 `static` 目录, 例如: `static/images/screenshot.png` +* 本地资源组织 + +{{< admonition note "本地资源引用" >}} +{{< version 0.2.10 >}} + +有三种方法来引用**图片**和**音乐**等本地资源: + +1. 使用[页面包](https://gohugo.io/content-management/page-bundles/)中的[页面资源](https://gohugo.io/content-management/page-resources/). + 你可以使用适用于 `Resources.GetMatch` 的值或者直接使用相对于当前页面目录的文件路径来引用页面资源. +2. 将本地资源放在 **assets** 目录中, 默认路径是 `/assets`. + 引用资源的文件路径是相对于 assets 目录的. +3. 将本地资源放在 **static** 目录中, 默认路径是 `/static`. + 引用资源的文件路径是相对于 static 目录的. + +引用的**优先级**符合以上的顺序. + +在这个主题中的很多地方可以使用上面的本地资源引用, +例如 **链接**, **图片**, `image` shortcode, `music` shortcode 和**前置参数**中的部分参数. + +页面资源或者 **assets** 目录中的[图片处理](https://gohugo.io/content-management/image-processing/)会在未来的版本中得到支持. +非常酷的功能! :(far fa-grin-squint fa-fw): +{{< /admonition >}} ## 2 前置参数 {#front-matter} @@ -138,11 +160,28 @@ library: * **comment**: {{< version 0.2.0 changed >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.comment` 部分相同. * **library**: {{< version 0.2.7 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.library` 部分相同. +{{< admonition tip >}} +{{< version 0.2.10 >}} + +**featuredImage** 和 **featuredImagePreview** 支持[本地资源引用](#contents-organization)的完整用法. + +如果带有在前置参数中设置了 `name: featured-image` 或 `name: featured-image-preview` 属性的页面资源, +没有必要在设置 `featuredImage` 或 `featuredImagePreview`: + +```yaml +resources: +- name: featured-image + src: featured-image.jpg +- name: featured-image-preview + src: featured-image-preview.jpg +``` +{{< /admonition >}} + ## 3 内容摘要 **LoveIt** 主题使用内容摘要在主页中显示大致文章信息。Hugo 支持生成文章的摘要. -![文章摘要预览](/images/theme-documentation-content/summary.zh-cn.png "文章摘要预览") +![文章摘要预览](summary.zh-cn.png "文章摘要预览") ### 自动摘要拆分 diff --git a/exampleSite/static/images/theme-documentation-content/summary.png b/exampleSite/content/posts/theme-documentation-content/summary.png similarity index 100% rename from exampleSite/static/images/theme-documentation-content/summary.png rename to exampleSite/content/posts/theme-documentation-content/summary.png diff --git a/exampleSite/static/images/theme-documentation-content/summary.zh-cn.png b/exampleSite/content/posts/theme-documentation-content/summary.zh-cn.png similarity index 100% rename from exampleSite/static/images/theme-documentation-content/summary.zh-cn.png rename to exampleSite/content/posts/theme-documentation-content/summary.zh-cn.png diff --git a/exampleSite/static/images/theme-documentation-extended-shortcodes/featured-image-preview.jpg b/exampleSite/content/posts/theme-documentation-extended-shortcodes/featured-image-preview.jpg similarity index 100% rename from exampleSite/static/images/theme-documentation-extended-shortcodes/featured-image-preview.jpg rename to exampleSite/content/posts/theme-documentation-extended-shortcodes/featured-image-preview.jpg diff --git a/exampleSite/static/images/theme-documentation-extended-shortcodes/featured-image.jpg b/exampleSite/content/posts/theme-documentation-extended-shortcodes/featured-image.jpg similarity index 100% rename from exampleSite/static/images/theme-documentation-extended-shortcodes/featured-image.jpg rename to exampleSite/content/posts/theme-documentation-extended-shortcodes/featured-image.jpg diff --git a/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.en.md b/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.en.md index 7325f52..cfb2220 100644 --- a/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.en.md +++ b/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.en.md @@ -7,12 +7,14 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "LoveIt theme provides multiple shortcodes on top of built-in ones in Hugo." -images: ["/images/theme-documentation-extended-shortcodes/featured-image-preview.jpg"] +resources: +- name: "featured-image" + src: "featured-image.jpg" +- name: "featured-image-preview" + src: "featured-image-preview.jpg" tags: ["shortcodes"] categories: ["documentation"] -featuredImage: "/images/theme-documentation-extended-shortcodes/featured-image.jpg" -featuredImagePreview: "/images/theme-documentation-extended-shortcodes/featured-image-preview.jpg" lightgallery: true --- @@ -59,6 +61,8 @@ This is a **right-aligned** paragraph. `link` shortcode is an alternative to [Markdown link syntax](../basic-markdown-syntax#links). `link` shortcode can provide some other features and can be used in code blocks. +{{< version 0.2.10 >}} The complete usage of [local resource references](../theme-documentation-content#contents-organization) is supported. + The `link` shortcode has the following named parameters: * **href** *[required]* (**first** positional parameter) @@ -123,6 +127,8 @@ The rendered output looks like this (hover over the link, there should be a tool `image` shortcode is an alternative to [`figure` shortcode](../theme-documentation-built-in-shortcodes#figure). `image` shortcode can take full advantage of the dependent libraries of [lazysizes](https://github.com/aFarkas/lazysizes) and [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js). +{{< version 0.2.10 >}} The complete usage of [local resource references](../theme-documentation-content#contents-organization) is supported. + The `image` shortcode has the following named parameters: * **src** *[required]* (**first** positional parameter) @@ -173,19 +179,15 @@ The `image` shortcode has the following named parameters: Additional `rel` attributes of the HTML `a` tag, if **linked** parameter is set to `true`. -* **large** *[optional]* - - Whether the image is large used for loading animation, if **linked** parameter is set to `false`. - Example `image` input: ```markdown -{{}} +{{}} ``` The rendered output looks like this: -{{< image src="/images/theme-documentation-extended-shortcodes/lighthouse.jpg" caption="Lighthouse (`image`)" src-s="/images/theme-documentation-extended-shortcodes/lighthouse-small.jpg" src-l="/images/theme-documentation-extended-shortcodes/lighthouse-large.jpg" >}} +{{< image src="/images/lighthouse.jpg" caption="Lighthouse (`image`)" src_s="/images/lighthouse-small.jpg" src_l="/images/lighthouse-large.jpg" >}} ## 4 admonition @@ -997,6 +999,8 @@ There are three ways to use it the `music` shortcode. ### 8.1 Custom Music URL {#custom-music-url} +{{< version 0.2.10 >}} The complete usage of [local resource references](../theme-documentation-content#contents-organization) is supported. + The `music` shortcode has the following named parameters by custom music URL: * **server** *[required]* @@ -1018,12 +1022,12 @@ The `music` shortcode has the following named parameters by custom music URL: Example `music` input by custom music URL: ```markdown -{{}} +{{}} ``` The rendered output looks like this: -{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/theme-documentation-extended-shortcodes/Wavelength.jpg" >}} +{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" >}} ### 8.2 Music Platform URL Automatic Identification {#automatic-identification} diff --git a/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.fr.md b/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.fr.md index 8b26bed..8cbecea 100644 --- a/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.fr.md +++ b/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.fr.md @@ -7,12 +7,14 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "Le thème LoveIt fournit plusieurs shortcodes en plus de ceux intégrés dans Hugo." -images: ["/images/theme-documentation-extended-shortcodes/featured-image-preview.jpg"] +resources: +- name: "featured-image" + src: "featured-image.jpg" +- name: "featured-image-preview" + src: "featured-image-preview.jpg" tags: ["shortcodes"] categories: ["documentation"] -featuredImage: "/images/theme-documentation-extended-shortcodes/featured-image.jpg" -featuredImagePreview: "/images/theme-documentation-extended-shortcodes/featured-image-preview.jpg" lightgallery: true --- @@ -64,6 +66,8 @@ This is a **right-aligned** paragraph. `link` shortcode is an alternative to [Markdown link syntax](../basic-markdown-syntax#links). `link` shortcode can provide some other features and can be used in code blocks. +{{< version 0.2.10 >}} The complete usage of [local resource references](../theme-documentation-content#contents-organization) is supported. + The `link` shortcode has the following named parameters: * **href** *[required]* (**first** positional parameter) @@ -128,6 +132,8 @@ The rendered output looks like this (hover over the link, there should be a tool `image` shortcode is an alternative to [`figure` shortcode](../theme-documentation-built-in-shortcodes#figure). `image` shortcode can take full advantage of the dependent libraries of [lazysizes](https://github.com/aFarkas/lazysizes) and [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js). +{{< version 0.2.10 >}} The complete usage of [local resource references](../theme-documentation-content#contents-organization) is supported. + The `image` shortcode has the following named parameters: * **src** *[required]* (**first** positional parameter) @@ -178,19 +184,15 @@ The `image` shortcode has the following named parameters: Additional `rel` attributes of the HTML `a` tag, if **linked** parameter is set to `true`. -* **large** *[optional]* - - Whether the image is large used for loading animation, if **linked** parameter is set to `false`. - Example `image` input: ```markdown -{{}} +{{}} ``` The rendered output looks like this: -{{< image src="/images/theme-documentation-extended-shortcodes/lighthouse.jpg" caption="Lighthouse (`image`)" src-s="/images/theme-documentation-extended-shortcodes/lighthouse-small.jpg" src-l="/images/theme-documentation-extended-shortcodes/lighthouse-large.jpg" >}} +{{< image src="/images/lighthouse.jpg" caption="Lighthouse (`image`)" src_s="/images/lighthouse-small.jpg" src_l="/images/lighthouse-large.jpg" >}} ## 4 admonition @@ -1002,6 +1004,8 @@ There are three ways to use it the `music` shortcode. ### 8.1 Custom Music URL {#custom-music-url} +{{< version 0.2.10 >}} The complete usage of [local resource references](../theme-documentation-content#contents-organization) is supported. + The `music` shortcode has the following named parameters by custom music URL: * **server** *[required]* @@ -1023,12 +1027,12 @@ The `music` shortcode has the following named parameters by custom music URL: Example `music` input by custom music URL: ```markdown -{{}} +{{}} ``` The rendered output looks like this: -{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/theme-documentation-extended-shortcodes/Wavelength.jpg" >}} +{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" >}} ### 8.2 Music Platform URL Automatic Identification {#automatic-identification} diff --git a/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.zh-cn.md b/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.zh-cn.md index 75c7cad..d2845f5 100644 --- a/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-extended-shortcodes/index.zh-cn.md @@ -7,12 +7,14 @@ draft: false author: "Dillon" authorLink: "https://dillonzq.com" description: "LoveIt 主题在 Hugo 内置的 shortcode 的基础上提供多个扩展的 shortcode." -images: ["/images/theme-documentation-extended-shortcodes/featured-image-preview.jpg"] +resources: +- name: "featured-image" + src: "featured-image.jpg" +- name: "featured-image-preview" + src: "featured-image-preview.jpg" tags: ["shortcodes"] categories: ["documentation"] -featuredImage: "/images/theme-documentation-extended-shortcodes/featured-image.jpg" -featuredImagePreview: "/images/theme-documentation-extended-shortcodes/featured-image-preview.jpg" lightgallery: true mapbox: @@ -62,6 +64,8 @@ This is a **right-aligned** paragraph. `link` shortcode 是 [Markdown 链接语法](../basic-markdown-syntax#links) 的替代. `link` shortcode 可以提供一些其它的功能并且可以在代码块中使用. +{{< version 0.2.10 >}} 支持[本地资源引用](../theme-documentation-content#contents-organization)的完整用法. + `link` shortcode 有以下命名参数: * **href** *[必需]* (**第一个**位置参数) @@ -126,6 +130,8 @@ This is a **right-aligned** paragraph. `image` shortcode 是 [`figure` shortcode](../theme-documentation-built-in-shortcodes#figure) 的替代. `image` shortcode 可以充分利用 [lazysizes](https://github.com/aFarkas/lazysizes) 和 [lightgallery.js](https://github.com/sachinchoolur/lightgallery.js) 两个依赖库. +{{< version 0.2.10 >}} 支持[本地资源引用](../theme-documentation-content#contents-organization)的完整用法. + `image` shortcode 有以下命名参数: * **src** *[必需]* (**第一个**位置参数) @@ -176,19 +182,15 @@ This is a **right-aligned** paragraph. HTML `a` 标签 的 `rel` 补充属性, 仅在 **linked** 属性设置成 `true` 时有效. -* **large** *[可选]* - - 图片是否是大尺寸的, 用来加载动画, 仅在 **linked** 属性设置成 `false` 时有效. - 一个 `image` 示例: ```markdown -{{}} +{{}} ``` 呈现的输出效果如下: -{{< image src="/images/theme-documentation-extended-shortcodes/lighthouse.jpg" caption="Lighthouse (`image`)" src-s="/images/theme-documentation-extended-shortcodes/lighthouse-small.jpg" src-l="/images/theme-documentation-extended-shortcodes/lighthouse-large.jpg" >}} +{{< image src="/images/lighthouse.jpg" caption="Lighthouse (`image`)" src_s="/images/lighthouse-small.jpg" src_l="/images/lighthouse-large.jpg" >}} ## 4 admonition @@ -1000,6 +1002,8 @@ data = [ ### 8.1 自定义音乐 URL {#custom-music-url} +{{< version 0.2.10 >}} 支持[本地资源引用](../theme-documentation-content#contents-organization)的完整用法. + `music` shortcode 有以下命名参数来使用自定义音乐 URL: * **server** *[必需]* @@ -1021,12 +1025,12 @@ data = [ 一个使用自定义音乐 URL 的 `music` 示例: ```markdown -{{}} +{{}} ``` 呈现的输出效果如下: -{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/theme-documentation-extended-shortcodes/Wavelength.jpg" >}} +{{< music url="/music/Wavelength.mp3" name=Wavelength artist=oldmanyoung cover="/images/Wavelength.jpg" >}} ### 8.2 音乐平台 URL 的自动识别 {#automatic-identification} diff --git a/exampleSite/static/images/theme-documentation-extended-shortcodes/Wavelength.jpg b/exampleSite/static/images/Wavelength.jpg similarity index 100% rename from exampleSite/static/images/theme-documentation-extended-shortcodes/Wavelength.jpg rename to exampleSite/static/images/Wavelength.jpg diff --git a/exampleSite/static/images/theme-documentation-extended-shortcodes/lighthouse-large.jpg b/exampleSite/static/images/lighthouse-large.jpg similarity index 100% rename from exampleSite/static/images/theme-documentation-extended-shortcodes/lighthouse-large.jpg rename to exampleSite/static/images/lighthouse-large.jpg diff --git a/exampleSite/static/images/theme-documentation-extended-shortcodes/lighthouse-small.jpg b/exampleSite/static/images/lighthouse-small.jpg similarity index 100% rename from exampleSite/static/images/theme-documentation-extended-shortcodes/lighthouse-small.jpg rename to exampleSite/static/images/lighthouse-small.jpg diff --git a/exampleSite/static/images/theme-documentation-built-in-shortcodes/lighthouse.jpg b/exampleSite/static/images/lighthouse.jpg similarity index 100% rename from exampleSite/static/images/theme-documentation-built-in-shortcodes/lighthouse.jpg rename to exampleSite/static/images/lighthouse.jpg diff --git a/exampleSite/static/images/theme-documentation-extended-shortcodes/lighthouse.jpg b/exampleSite/static/images/theme-documentation-extended-shortcodes/lighthouse.jpg deleted file mode 100644 index b857404..0000000 Binary files a/exampleSite/static/images/theme-documentation-extended-shortcodes/lighthouse.jpg and /dev/null differ diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index f1f016d..a79cddf 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,10 +1,10 @@ -{{- with .Title -}} +{{- if .Title -}}
- {{- dict "src" $.Destination "alt" $.Text "caption" . "linked" true | partial "plugin/image.html" -}} + {{- dict "Src" .Destination "Title" .Text "Caption" .Title "Linked" true "Resources" .Page.Resources | partial "plugin/image.html" -}}
- {{- . | safeHTML -}} + {{- .Title | safeHTML -}}
{{- else -}} - {{- dict "src" .Destination "alt" .Text | partial "plugin/image.html" -}} + {{- dict "Src" .Destination "Title" .Text "Resources" .Page.Resources | partial "plugin/image.html" -}} {{- end -}} diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html index 35e77e8..0c05396 100644 --- a/layouts/_default/_markup/render-link.html +++ b/layouts/_default/_markup/render-link.html @@ -1,2 +1,6 @@ -{{- $options := dict "href" .Destination "title" .Title "content" .Text -}} +{{- $destination := .Destination -}} +{{- with dict "Path" $destination "Resources" .Page.Resources | partial "function/resource.html" -}} + {{- $destination = .RelPermalink -}} +{{- end -}} +{{- $options := dict "Destination" $destination "Title" .Title "Content" .Text -}} {{- partial "plugin/link.html" $options -}} diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index f869a9a..990b6a9 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -1,10 +1,18 @@ {{- $params := .Params | merge .Site.Params.page -}} +
{{- /* Featured image */ -}} - {{- with $params.featuredimagepreview | default $params.featuredimage -}} + {{- $image := $params.featuredimagepreview | default $params.featuredimage -}} + {{- with .Resources.GetMatch "featured-image" -}} + {{- $image = .RelPermalink -}} + {{- end -}} + {{- with .Resources.GetMatch "featured-image-preview" -}} + {{- $image = .RelPermalink -}} + {{- end -}} + {{- with $image -}} {{- end -}} @@ -19,7 +27,7 @@ {{- $author := $params.author | default .Site.Author.name | default (T "author") -}} {{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}} diff --git a/layouts/partials/assets.html b/layouts/partials/assets.html index 45707b2..2ae78b7 100644 --- a/layouts/partials/assets.html +++ b/layouts/partials/assets.html @@ -5,59 +5,57 @@ {{- /* Smooth Scroll */ -}} {{- $source := $cdn.smoothScrollJS | default "lib/smooth-scroll/smooth-scroll.min.js" -}} -{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} +{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- /* Search */ -}} {{- if .Site.Params.search | and .Site.Params.search.enable -}} {{- $search := .Site.Params.search -}} {{- $source := $cdn.autocompleteJS | default "lib/autocomplete/autocomplete.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "maxResultLength" $search.maxResultLength "snippetLength" $search.snippetLength "highlightTag" $search.highlightTag "noResultsFound" (T "noResultsFound") | dict "search" | merge $config -}} {{- if eq $search.type "lunr" -}} {{- with .Site.Home.OutputFormats.Get "json" -}} {{- $config = dict "type" "lunr" "lunrIndexURL" .RelPermalink | dict "search" | merge $config -}} {{- end -}} {{- $source := $cdn.lunrJS | default "lib/lunr/lunr.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- if T "lunrLanguageLib" -}} {{- $config = T "lunrLanguageCode" | dict "lunrLanguageCode" | dict "search" | merge $config -}} {{- with T "lunrSegmentitLib" -}} {{- $config = dict "lunrSegmentitURL" (resources.Get .).RelPermalink | dict "search" | merge $config -}} {{- end -}} - {{- dict "source" "lib/lunr/lunr.stemmer.support.js" "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} - {{- dict "source" (T "lunrLanguageLib") "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" "lib/lunr/lunr.stemmer.support.js" "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" (T "lunrLanguageLib") "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- else if eq $search.type "algolia" -}} {{- $source := $cdn.algoliasearchJS | default "lib/algoliasearch/algoliasearch-lite.umd.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "type" "algolia" "algoliaIndex" $search.algolia.index "algoliaAppID" $search.algolia.appID "algoliaSearchKey" $search.algolia.searchKey | dict "search" | merge $config -}} {{- end -}} {{- end -}} {{- /* lazysizes */ -}} {{- $source := $cdn.lazysizesJS | default "lib/lazysizes/lazysizes.min.js" -}} -{{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} +{{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- /* twemoji */ -}} {{- if $params.twemoji -}} {{- $source := $cdn.twemojiJS | default "lib/twemoji/twemoji.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "twemoji" true | merge $config -}} {{- end -}} {{- /* lightgallery.js */ -}} {{- if $params.lightgallery -}} {{- $source := $cdn.lightgalleryCSS | default "lib/lightgallery/lightgallery.min.css" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.lightgalleryJS | default "lib/lightgallery/lightgallery.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $source := $cdn.lightgalleryThumbnailJS | default "lib/lightgallery/lg-thumbnail.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $source := $cdn.lightgalleryZoomJS | default "lib/lightgallery/lg-zoom.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "selector" ".lightgallery" "speed" 400 "hideBarsDelay" 2000 "thumbnail" true "exThumbImage" "data-thumbnail" "thumbWidth" 80 "thumbContHeight" 80 "actualSize" false | dict "lightGallery" | merge $config -}} - {{- $styleArr := (.Scratch.Get "this").styleArr | default slice -}} - {{- $styleArr | append ".lg-toolbar .lg-icon::after { color: #999; }" | .Scratch.SetInMap "this" "styleArr" -}} {{- end -}} {{- $code := $params.code | default dict -}} @@ -66,21 +64,21 @@ {{- /* clipboard.js */ -}} {{- if ne $code.copy false -}} {{- $source := $cdn.clipboardJS | default "lib/clipboard/clipboard.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = T "copyToClipboard" | dict "copyTitle" | dict "code" | merge $config -}} {{- end -}} {{- /* Sharer.js */ -}} {{- if $params.share.enable -}} {{- $source := $cdn.sharerJS | default "lib/sharer/sharer.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- /* TypeIt */ -}} {{- with (.Scratch.Get "this").typeitMap -}} {{- $typeit := $.Site.Params.typeit -}} {{- $source := $cdn.typeitJS | default "lib/typeit/typeit.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "data" . | dict "typeit" | merge $config -}} {{- end -}} @@ -93,20 +91,20 @@ {{- end -}} {{- if $math.enable -}} {{- $source := $cdn.katexCSS | default "lib/katex/katex.min.css" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.katexJS | default "lib/katex/katex.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $source := $cdn.katexAutoRenderJS | default "lib/katex/auto-render.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- if $math.copyTex -}} {{- $source := $cdn.katexCopyTexCSS | default "lib/katex/copy-tex.min.css" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.katexCopyTexJS | default "lib/katex/copy-tex.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- if $math.mhchem -}} {{- $source := $cdn.katexMhchemJS | default "lib/katex/mhchem.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- $delimiters := slice (dict "left" "$$" "right" "$$" "display" true) (dict "left" "\\[" "right" "\\]" "display" true) -}} {{- if and $math.blockLeftDelimiter $math.blockRightDelimiter -}} @@ -122,26 +120,26 @@ {{- /* mermaid */ -}} {{- if (.Scratch.Get "this").mermaid -}} {{- $source := $cdn.mermaidJS | default "lib/mermaid/mermaid.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $options := dict "targetPath" "lib/mermaid/mermaid.min.css" "enableSourceMap" true -}} - {{- dict "source" "lib/mermaid/mermaid.scss" "toCSS" $options "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" "lib/mermaid/mermaid.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- end -}} {{- /* ECharts */ -}} {{- if (.Scratch.Get "this").echarts -}} {{- $source := $cdn.echartsJS | default "lib/echarts/echarts.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $source := $cdn.echartsMacaronsJS | default "lib/echarts/macarons.js" -}} - {{- dict "source" $source "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- /* Mapbox GL */ -}} {{- if (.Scratch.Get "this").mapbox -}} {{- $source := $cdn.mapboxGLCSS | default "lib/mapbox-gl/mapbox-gl.min.css" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.mapboxGLJS | default "lib/mapbox-gl/mapbox-gl.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} - {{- dict "source" "lib/mapbox-gl/mapbox-gl-language.js" "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" "lib/mapbox-gl/mapbox-gl-language.js" "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $config = dict "accessToken" $params.mapbox.accessToken "RTLTextPlugin" "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js" | dict "mapbox" | merge $config -}} {{- end -}} @@ -149,23 +147,23 @@ {{- if (.Scratch.Get "this").music -}} {{- /* APlayer */ -}} {{- $source := $cdn.aplayerCSS | default "lib/aplayer/APlayer.min.css" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $options := dict "targetPath" "lib/aplayer/dark.min.css" "enableSourceMap" true -}} - {{- dict "source" "lib/aplayer/dark.scss" "toCSS" $options "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" "lib/aplayer/dark.scss" "ToCSS" $options "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.aplayerJS | default "lib/aplayer/APlayer.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- /* MetingJS */ -}} {{- $source := $cdn.metingJS | default "lib/meting/Meting.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- /* Cookie Consent */ -}} {{- if .Site.Params.cookieconsent | and .Site.Params.cookieconsent.enable -}} {{- $source := $cdn.cookieconsentCSS | default "lib/cookieconsent/cookieconsent.min.css" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.cookieconsentJS | default "lib/cookieconsent/cookieconsent.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $cookieconsentConfig := dict "popup" (dict "background" "#1aa3ff") "button" (dict "background" "#f0f0f0") | dict "theme" "edgeless" "palette" -}} {{- $cookieconsentConfig = .Site.Params.cookieconsent | merge $cookieconsentConfig -}} {{- $cookieconsentConfig = dict "message" ($cookieconsentConfig.content.message | default (T "cookieconsentMessage")) "dismiss" ($cookieconsentConfig.content.dismiss | default (T "cookieconsentDismiss")) "link" ($cookieconsentConfig.content.link | default (T "cookieconsentLink")) | dict "content" | merge $cookieconsentConfig -}} @@ -173,26 +171,29 @@ {{- end -}} {{- range $params.library.css -}} - {{- dict "source" . "fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" . "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}} {{- end -}} {{- range $params.library.js -}} - {{- dict "source" . "fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" . "Fingerprint" $fingerprint | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- with (.Scratch.Get "this").styleArr -}} - {{- delimit . "" | dict "content" | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}} + {{- $content := delimit . "" -}} + {{- $path := substr (md5 $content) 0 6 | printf "css/%v" -}} + {{- $options := printf "%v.min.css" $path | dict "targetPath" -}} + {{- dict "Content" $content "Path" (printf "%v.scss" $path) "ToCSS" $options | dict "Scratch" $.Scratch "Data" | partial "scratch/style.html" -}} {{- end -}} {{- /* Config script */ -}} -{{- $config | jsonify | printf "window.config=%s;" | dict "content" | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} +{{- $config | jsonify | printf "window.config=%s;" | dict "Content" | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- /* Theme script */ -}} -{{- dict "source" "js/theme.min.js" "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} +{{- dict "Source" "js/theme.min.js" "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}} {{- with (.Scratch.Get "this").scriptArr -}} - {{- delimit . "\n" | dict "content" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} + {{- delimit . "\n" | dict "Content" | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- range (.Scratch.Get "this").style -}} @@ -203,6 +204,4 @@ {{- partial "plugin/script.html" . -}} {{- end -}} -{{- with .Scratch.Get "analytics" -}} - {{- partial "plugin/analytics.html" . -}} -{{- end -}} +{{- partial "plugin/analytics.html" . -}} diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html index 1239769..0382ae1 100644 --- a/layouts/partials/comment.html +++ b/layouts/partials/comment.html @@ -10,7 +10,7 @@ {{- if $disqus.enable -}}
{{- $source := printf "https://%v.disqus.com/embed.js" $disqus.shortname -}} - {{- dict "source" $source "defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} @@ -21,9 +21,9 @@ {{- if $gitalk.enable -}}
{{- $source := $cdn.gitalkCSS | default "lib/gitalk/gitalk.css" -}} - {{- dict "source" $source "minify" true "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} + {{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/style.html" -}} {{- $source := $cdn.gitalkJS | default "lib/gitalk/gitalk.min.js" -}} - {{- dict "source" $source "fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} + {{- dict "Source" $source "Fingerprint" $fingerprint | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $commentConfig = dict "id" .Date "title" .Title "clientID" $gitalk.clientId "clientSecret" $gitalk.clientSecret "repo" $gitalk.repo "owner" $gitalk.owner "admin" (slice $gitalk.owner) | dict "gitalk" | merge $commentConfig -}}