♻️ Refactor: refactor the feed and search features (#490)

* 🔍 Refactor: add JSON feed support and refactor output formats build in FixIt

Close #475

* 🚚 Feat: migrate index templates to layouts/_default folder and home.[name].html

* 📝 Style(ignore): fix typo

* 🚚 Chore: migrate index templates to default home templates

* 🚚 Chore: migrate section templates to layouts/section folder

*  Feat: add JSON feed support for section pages (#475)

* 🚧 Feat: add common template for JSON feed (#475)

* 🚧 Feat: add JSON feed support for section and term list pages

* 🚀 Chore: fix git stage error in update-version script

*  Perf: add front matter hiddenFromFeed for JSON feed (#475)

* 🔍 Feat: add tags attribute for JSON feed (#475)

* ♻️ Refactor: refactor RSS feed templates

Close #488

* 🚧 WIP: rename json-feed.html to json.html

* 🚧 Feat: revert single.md

*  Perf: enhance JSON feed 1.1 compatibility

* ♻️ Refactor: refactor post author map getting

*  WIP: add featured image support in feed

* 📝 Docs: update README and screenshot

* 🔧 Chore: update changelog template

* 🚧 WIP: add feed scoped config for section and list

* 🔥 Feat: migrate JSON feed to hugo-fixit/hugo-json-feed

Close hugo-fixit/hugo-json-feed#1

* 🚚 Feat: remove front matter hiddenFromRss and rssFullText,  add  front matter hiddenFromFeed
This commit is contained in:
Cell
2024-08-24 17:30:31 +08:00
committed by GitHub
parent 6a83650506
commit 3ffef8acb0
32 changed files with 359 additions and 381 deletions
+2
View File
@@ -1,5 +1,7 @@
# CONTRIBUTING
Make sure that you follow [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) while contributing and engaging in the discussions.
## How to contribute to this project
First, fork this repository by clicking the fork button.
+42 -26
View File
@@ -1,37 +1,57 @@
# FixIt Theme | Hugo
<!-- markdownlint-disable-file MD033 MD041 -->
![Hugo Theme FixIt](https://fixit.lruihao.cn/images/apple-devices-preview.png)
<div align="center">English | <a href="README.zh-cn.md">简体中文</a></div>
<a title="FixIt website" href="https://fixit.lruihao.cn"><img align="right" alt="FixIt logo" width="70" height="70" src="https://avatars.githubusercontent.com/u/110414864?s=200&v=4"></a>
# FixIt
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/hugo-fixit/FixIt?style=flat)](https://github.com/hugo-fixit/FixIt/releases)
[![Hugo](https://img.shields.io/badge/Hugo-%5E0.127.0-ff4088?style=flat&logo=hugo)](https://gohugo.io/)
[![License](https://img.shields.io/github/license/hugo-fixit/FixIt?style=flat)](/LICENSE)
[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/hugo-fixit/FixIt)
👉 English README | [简体中文说明](README.zh-cn.md)
> «FixIt» is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/).
[FixIt](https://github.com/hugo-fixit/FixIt) is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/).
It is based on the original [LoveIt](https://github.com/dillonzq/LoveIt) Theme, [KeepIt](https://github.com/Fastbyte01/KeepIt) Theme and [LeaveIt](https://github.com/liuzc/LeaveIt) Theme.
It is based on the original [LoveIt Theme](https://github.com/dillonzq/LoveIt), [KeepIt Theme](https://github.com/Fastbyte01/KeepIt) and [LeaveIt Theme](https://github.com/liuzc/LeaveIt).[^1]
## Live Preview
![Hugo Theme FixIt](https://fixit.lruihao.cn/images/apple-devices-preview.webp)
<p align="center">
💟 <a href="https://fixit.lruihao.cn">Production</a> | ❇️ <a href="https://pre.fixit.lruihao.cn">Preview</a> | 🚼 <a href="https://demo.fixit.lruihao.cn">Demo</a> | 🆕 <a href="https://hugo-fixit.github.io/hugo-fixit-starter/">Starter</a>
<br>
<br>
More «FixIt» examples <a href="https://fixit.lruihao.cn/showcase/">here</a>.
</p>
## Getting started
## Documentation
1. [Installation](https://fixit.lruihao.cn/documentation/installation/)
2. [Getting Started](https://fixit.lruihao.cn/documentation/getting-started/)
3. [Content Management](https://fixit.lruihao.cn/documentation/content-management/)
4. [Advanced Usage](https://fixit.lruihao.cn/documentation/advanced/)
Head to the [Quick Start](https://fixit.lruihao.cn/documentation/getting-started/quick-start/) page for a step-by-step guide on how to create a new website with FixIt.
Alternatively, you can run the [documentation site](https://fixit.lruihao.cn/) locally. For more details, see [hugo-fixit/docs](https://github.com/hugo-fixit/docs).
Outline: [Installation](https://fixit.lruihao.cn/documentation/installation/) ➜ [Getting Started](https://fixit.lruihao.cn/documentation/getting-started/) ➜ [Content Management](https://fixit.lruihao.cn/documentation/content-management/) ➜ [Advanced Usage](https://fixit.lruihao.cn/documentation/advanced/)
## Template repository
- [hugo-fixit/hugo-fixit-start](https://github.com/hugo-fixit/hugo-fixit-start/generate)
- [hugo-fixit/hugo-fixit-start1](https://github.com/hugo-fixit/hugo-fixit-start1/generate)
- [hugo-fixit/docs](https://github.com/hugo-fixit/docs/generate)
- [Lruihao/hugo-blog](https://github.com/Lruihao/hugo-blog/generate)
Click the following links to generate a new repository with template:
## Who used FixIt
| Template repository | Generate link |
| :----------------------------------------- | :----------------------------: |
| [hugo-fixit/hugo-fixit-starter][starter] | [Click][starter:generate] |
| [hugo-fixit/hugo-fixit-starter1][starter1] | [Click][starter1:generate] |
| [hugo-fixit/docs][docs] | [Click][docs:generate] |
| [Lruihao/hugo-blog][lruihao-blog] | [Click][lruihao-blog:generate] |
To see this theme in action, here are some [live demo sites](https://fixit.lruihao.cn/friends/) which are rendered with **FixIt** theme.
[starter]: https://github.com/hugo-fixit/hugo-fixit-starter
[starter:generate]: https://github.com/hugo-fixit/hugo-fixit-starter/generate
[starter1]: https://github.com/hugo-fixit/hugo-fixit-starter1
[starter1:generate]: https://github.com/hugo-fixit/hugo-fixit-starter1/generate
[docs]: https://github.com/hugo-fixit/docs
[docs:generate]: https://github.com/hugo-fixit/docs/generate
[lruihao-blog]: https://github.com/Lruihao/hugo-blog
[lruihao-blog:generate]: https://github.com/Lruihao/hugo-blog/generate
<!-- ## Why choose FixIt -->
## Features
@@ -96,12 +116,12 @@ To see this theme in action, here are some [live demo sites](https://fixit.lruih
- Kinds of **admonitions** shortcode
- **Custom style** shortcode
- **Custom script** shortcode
- Open more **custom blocks**
- **Animated typing** supported by [TypeIt](https://typeitjs.com/)
- **Cookie consent banner** supported by [cookieconsent](https://github.com/osano/cookieconsent)
- **Web Watermark** supported by [cell-watermark](https://github.com/Lruihao/watermark)
- **Chinese typesetting** supported by [pangu.js](https://github.com/vinta/pangu.js)
- Options to **cache remote image** locally
- High **extensibility**
- ...
### Theme Components
@@ -152,13 +172,12 @@ Don't forget to leave a ⭐️ if you like this theme, thanks!
## Contributing
- [Roadmap of FixIt](https://github.com/orgs/hugo-fixit/projects/2)
We welcome you to join the development of FixIt. Please see [contributing document](CONTRIBUTING.md). 🤗
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for getting started with the contribution.
Also, we welcome Issue or PR to our [official-components](https://github.com/hugo-fixit).
Make sure that you follow [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) while contributing and engaging in the discussions.
**When contributing, please first discuss the change you wish to make via an issue on this repository before making the actual change**.
> [!note]
> When contributing, please first discuss the change you wish to make via a discussion on this repository before making the actual change.
## Acknowledgements
@@ -226,6 +245,3 @@ If you enjoy the theme, please consider buying me a coffee ☕️. Thanks!
## Author
[Lruihao](https://github.com/Lruihao "Follow me on GitHub")
<!-- footnote reference definition -->
[^1]: The theme name is interesting: "leave it, keep it, love it, fix it". Appears and leaves, loves but cannot keep. Doesn't it look like that damn love and BUG? 🤣
+46 -30
View File
@@ -1,37 +1,57 @@
# FixIt 主题 | Hugo
<!-- markdownlint-disable-file MD033 MD041 -->
![Hugo Theme FixIt](https://fixit.lruihao.cn/images/apple-devices-preview.png)
<div align="center"><a href="README.md">English</a> | 简体中文</div>
<a title="FixIt 官网" href="https://fixit.lruihao.cn/zh-cn/"><img align="right" alt="FixIt logo" width="70" height="70" src="https://avatars.githubusercontent.com/u/110414864?s=200&v=4"></a>
# FixIt
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/hugo-fixit/FixIt?style=flat)](https://github.com/hugo-fixit/FixIt/releases)
[![Hugo](https://img.shields.io/badge/Hugo-%5E0.127.0-ff4088?style=flat&logo=hugo)](https://gohugo.io/)
[![License](https://img.shields.io/github/license/hugo-fixit/FixIt?style=flat)](/LICENSE)
[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/hugo-fixit/FixIt)
👉 [English README](README.md) | 简体中文说明
> «FixIt» 是一个**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。
[FixIt](https://github.com/hugo-fixit/FixIt) 是一个**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。
它的原型基于 [LoveIt](https://github.com/dillonzq/LoveIt) 主题,[KeepIt](https://github.com/Fastbyte01/KeepIt) 主题和 [LeaveIt](https://github.com/liuzc/LeaveIt) 主题。
它的原型基于 [LoveIt 主题](https://github.com/dillonzq/LoveIt)[KeepIt 主题](https://github.com/Fastbyte01/KeepIt) 和 [LeaveIt 主题](https://github.com/liuzc/LeaveIt)。[^1]
## 即时预览
![Hugo Theme FixIt](https://fixit.lruihao.cn/images/apple-devices-preview.webp)
<p align="center">
💟 <a href="https://fixit.lruihao.cn/zh-cn/">Production</a> | ❇️ <a href="https://pre.fixit.lruihao.cn/zh-cn/">Preview</a> | 🚼 <a href="https://demo.fixit.lruihao.cn">Demo</a> | 🆕 <a href="https://hugo-fixit.github.io/hugo-fixit-starter/">Starter</a>
<br>
<br>
更多 «FixIt» 的例子参见 <a href="https://fixit.lruihao.cn/zh-cn/showcase/">这里</a>。
</p>
## 主题文档
1. [安装篇](https://fixit.lruihao.cn/zh-cn/documentation/installation/)
2. [入门篇](https://fixit.lruihao.cn/zh-cn/documentation/getting-started/)
3. [内容管理](https://fixit.lruihao.cn/zh-cn/documentation/content-management/)
4. [进阶篇](https://fixit.lruihao.cn/zh-cn/documentation/advanced/)
前往 [快速上手](https://fixit.lruihao.cn/zh-cn/documentation/getting-started/quick-start/) 页面,了解如何使用 FixIt 主题创建一个新网站的详细步骤。
或者在本地运行 [文档站点](https://fixit.lruihao.cn/zh-cn/),更多细节详见 [hugo-fixit/docs](https://github.com/hugo-fixit/docs)
大纲:[安装篇](https://fixit.lruihao.cn/zh-cn/documentation/installation/) ➜ [入门篇](https://fixit.lruihao.cn/zh-cn/documentation/getting-started/) ➜ [内容管理](https://fixit.lruihao.cn/zh-cn/documentation/content-management/) ➜ [进阶篇](https://fixit.lruihao.cn/zh-cn/documentation/advanced/)
## 模板仓库
- [hugo-fixit/hugo-fixit-start](https://github.com/hugo-fixit/hugo-fixit-start/generate)
- [hugo-fixit/hugo-fixit-start1](https://github.com/hugo-fixit/hugo-fixit-start1/generate)
- [hugo-fixit/docs](https://github.com/hugo-fixit/docs/generate)
- [Lruihao/hugo-blog](https://github.com/Lruihao/hugo-blog/generate)
点击以下链接使用模板生成一个新的仓库:
## 谁在用 FixIt
| 模板仓库 | 生成链接 |
| :----------------------------------------- | :-------------------------------: |
| [hugo-fixit/hugo-fixit-starter][starter] | [点击生成][starter:generate] |
| [hugo-fixit/hugo-fixit-starter1][starter1] | [点击生成][starter1:generate] |
| [hugo-fixit/docs][docs] | [点击生成][docs:generate] |
| [Lruihao/hugo-blog][lruihao-blog] | [点击生成][lruihao-blog:generate] |
为了直观地浏览主题特性,这里有一些基于 **FixIt** 主题渲染的 [预览网站](https://fixit.lruihao.cn/zh-cn/friends/)。
[starter]: https://github.com/hugo-fixit/hugo-fixit-starter
[starter:generate]: https://github.com/hugo-fixit/hugo-fixit-starter/generate
[starter1]: https://github.com/hugo-fixit/hugo-fixit-starter1
[starter1:generate]: https://github.com/hugo-fixit/hugo-fixit-starter1/generate
[docs]: https://github.com/hugo-fixit/docs
[docs:generate]: https://github.com/hugo-fixit/docs/generate
[lruihao-blog]: https://github.com/Lruihao/hugo-blog
[lruihao-blog:generate]: https://github.com/Lruihao/hugo-blog/generate
<!-- ## 为什么选择 FixIt -->
## 特性
@@ -96,17 +116,17 @@
- 支持多种**注释**的 shortcode
- 支持**自定义样式**的 shortcode
- 支持**自定义脚本**的 shortcode
- 支持**自定义模板块**
- 支持基于 [TypeIt](https://typeitjs.com/) 的**打字动画** shortcode
- 支持基于 [cookieconsent](https://github.com/osano/cookieconsent) 的 **Cookie 许可横幅**
- 支持基于 [cell-watermark](https://github.com/Lruihao/watermark) 的**网页水印**
- 支持基于 [pangu.js](https://github.com/vinta/pangu.js) 的**中文排版**
- 支持本地**缓存远程图床图片**
- 高**扩展性**
- ……
### 主题组件
FixIt 主题旨在在 **简洁性****可扩展性** 之间取得平衡。为此,我们开发了一系列额外的 [Hugo 主题组件](https://fixit.lruihao.cn/zh-cn/components/) 供用户选择。
FixIt 主题旨在在**简洁性**和**可扩展性**之间取得平衡。为此,我们开发了一系列额外的 [Hugo 主题组件](https://fixit.lruihao.cn/zh-cn/components/) 供用户选择。
## 多语言和国际化
@@ -130,6 +150,10 @@ FixIt 支持下列语言:
[语言兼容性](https://fixit.lruihao.cn/zh-cn/theme-documentation-basics/#language-compatibility)
## 镜像
Gitee 镜像仓库:<https://gitee.com/lruihao/FixIt>
## 社区支持
所有的反馈都是欢迎的!详见 [Discussions][discussions]、[Pull requests][pulls] 和 [Issues][issues]。
@@ -152,17 +176,12 @@ FixIt 支持下列语言:
## 参与贡献
- [Hugo FixIt 路线图](https://github.com/orgs/hugo-fixit/projects/2)
我们欢迎你加入 FixIt 的开发,贡献出你的一份力量。请看开源 [贡献指南](CONTRIBUTING.md)。 🤗
请参阅 [CONTRIBUTING.md](CONTRIBUTING.md) 以了解贡献该项目的基本信息
你也可以随时向我们的 [官方插件](https://github.com/hugo-fixit) 提交 Issue 或 Pull Request
确保在贡献和参与讨论时遵守 [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)。
**贡献时,请先通过此存储库上的问题讨论你希望进行的更改,然后再进行实际更改**
## 镜像
- Gitee 镜像仓库:<https://gitee.com/lruihao/FixIt>
> [!note]
> 在贡献时,请先通过此存储库上的讨论来讨论你希望进行的更改,然后再进行实际更改。
## 致谢
@@ -230,6 +249,3 @@ FixIt 根据 **MIT** 许可协议授权。更多信息请查看 [LICENSE 文件]
## 作者
[Lruihao](https://github.com/Lruihao "在 GitHub 上关注我")
<!-- footnote reference definition -->
[^1]: 主题名称趣谈:“leave it, keep itlove itfix it”。出现又离开,爱而不得。这像不像那该死的爱情和 BUG 呢?🤣
+1 -1
View File
@@ -20,8 +20,8 @@ categories:
- draft
hiddenFromHomePage: false
hiddenFromSearch: false
hiddenFromRss: false
hiddenFromRelated: false
hiddenFromFeed: false
summary:
resources:
- name: featured-image
+1 -1
View File
@@ -20,8 +20,8 @@ categories:
- draft
hiddenFromHomePage: false
hiddenFromSearch: false
hiddenFromRss: false
hiddenFromRelated: false
hiddenFromFeed: false
summary:
resources:
- name: featured-image
+1 -1
View File
@@ -15,7 +15,7 @@ All notable changes to this project will be documented in this file.
{{/if}}
{{!-- List commits with `Breaking change: ` somewhere in the message --}}
{{#commit-list commits heading='### :boom: Breaking Changes' message='^(Breaking change|BREAKING CHANGE):'}}
{{#commit-list commits heading='### :boom: Breaking Changes' message='(:boom:|Breaking change:|BREAKING CHANGE:)'}}
- {{subject}} [`{{shorthash}}`]({{href}}) by {{githubUser author}}
{{/commit-list}}
+2 -2
View File
@@ -39,8 +39,8 @@ const latestVersion = stage === 'version' ? version : devVersion;
const lastVersion = initHtml.match(/v\d+\.\d+\.\d+(-\w+)?/)[0];
const newInitHtml = initHtml.replace(/v\d+\.\d+\.\d+(-\w+)?/, `v${latestVersion}`);
fs.writeFileSync(initHtmlPath, newInitHtml);
// Add the updated file to the git stage
execSync('git add .');
// Add the updated files to the git stage
execSync('git add layouts/partials/init/index.html package.json package-lock.json');
console.log(`Update the FixIt version from ${lastVersion} to v${latestVersion}.`);
export default latestVersion;
+47 -33
View File
@@ -231,12 +231,8 @@ enableEmoji = true
# -------------------------------------------------------------------------------------
[mediaTypes]
# Options to make output .md files
[mediaTypes."text/markdown"]
suffixes = ["md"]
# Options to make output .txt files
[mediaTypes."text/plain"]
suffixes = ["txt"]
# [mediaTypes."application/feed+json"]
# suffixes = ["json"]
# -------------------------------------------------------------------------------------
# Output Format Definitions
@@ -244,11 +240,6 @@ enableEmoji = true
# -------------------------------------------------------------------------------------
[outputFormats]
# Options to make output .md files
[outputFormats.MarkDown]
mediaType = "text/markdown"
isPlainText = true
isHTML = false
# FixIt 0.3.0 | NEW Options to make output /archives/index.html file
[outputFormats.archives]
path = "archives"
@@ -257,6 +248,7 @@ enableEmoji = true
isPlainText = false
isHTML = true
permalinkable = true
notAlternative = true
# FixIt 0.3.0 | NEW Options to make output /offline/index.html file
[outputFormats.offline]
path = "offline"
@@ -265,18 +257,29 @@ enableEmoji = true
isPlainText = false
isHTML = true
permalinkable = true
notAlternative = true
# FixIt 0.3.0 | NEW Options to make output readme.md file
[outputFormats.README]
[outputFormats.readme]
baseName = "readme"
mediaType = "text/markdown"
isPlainText = true
isHTML = false
notAlternative = true
# FixIt 0.3.0 | CHANGED Options to make output baidu_urls.txt file
[outputFormats.baidu_urls]
baseName = "baidu_urls"
mediaType = "text/plain"
isPlainText = true
isHTML = false
notAlternative = true
# FixIt 0.3.10 | NEW Options to make output search.json file
[outputFormats.search]
baseName = "search"
mediaType = "application/json"
rel = "search"
isPlainText = true
isHTML = false
permalinkable = true
# -------------------------------------------------------------------------------------
# Customizing Output Formats
@@ -284,17 +287,17 @@ enableEmoji = true
# -------------------------------------------------------------------------------------
# Options to make hugo output files, the optional values are below:
# home: ["HTML", "RSS", "JSON", "archives", "offline", "README", "baidu_urls"]
# page: ["HTML", "MarkDown"]
# section: ["HTML", "RSS"]
# taxonomy: ["HTML", "RSS"]
# term: ["HTML", "RSS"]
# home = ["html", "rss", "archives", "offline", "readme", "baidu_urls", "search"]
# page = ["html", "markdown"]
# section = ["html", "rss"]
# taxonomy = ["html"]
# term = ["html", "rss"]
[outputs]
home = ["HTML", "RSS", "JSON", "archives"]
page = ["HTML", "MarkDown"]
section = ["HTML", "RSS"]
taxonomy = ["HTML"]
term = ["HTML", "RSS"]
home = ["html", "rss", "archives", "search"]
page = ["html", "markdown"]
section = ["html", "rss"]
taxonomy = ["html"]
term = ["html", "rss"]
# -------------------------------------------------------------------------------------
# Taxonomies Configuration
@@ -497,8 +500,12 @@ enableEmoji = true
paginate = 20
# date format (month and day)
dateFormat = "01-02"
# amount of RSS pages
rss = 10
# FixIt 0.3.10 | NEW Section feed config for RSS, Atom and JSON feed.
[params.section.feed]
# The number of posts to include in the feed. If set to -1, all posts.
limit = -1
# whether to show the full text content in feed.
fullText = false
# FixIt 0.2.13 | NEW recently updated pages config
# TODO refactor to support archives, section, taxonomy and term
[params.section.recentlyUpdated]
@@ -507,14 +514,18 @@ enableEmoji = true
days = 30
maxCount = 10
# List (category or tag) page config
# Term list (category or tag) page config
[params.list]
# special amount of posts in each list page
paginate = 20
# date format (month and day)
dateFormat = "01-02"
# amount of RSS pages
rss = 10
# FixIt 0.3.10 | NEW Term list feed config for RSS, Atom and JSON feed.
[params.list.feed]
# The number of posts to include in the feed. If set to -1, all posts.
limit = -1
# whether to show the full text content in feed.
fullText = false
# FixIt 0.2.17 | NEW TagCloud config for tags page
[params.tagcloud]
@@ -526,8 +537,6 @@ enableEmoji = true
# Home page config
[params.home]
# amount of RSS pages
rss = 10
# Home page profile
[params.home.profile]
enable = false
@@ -807,6 +816,13 @@ enableEmoji = true
# ["barber-shop", "big-counter", "bounce", "center-atom", "center-circle", "center-radar", "center-simple",
# "corner-indicator", "fill-left", "flash", "flat-top", "loading-bar", "mac-osx", "material", "minimal"]
theme = "minimal"
# FixIt 0.3.10 | NEW Global Feed config for RSS, Atom and JSON feed.
[params.feed]
# The number of posts to include in the feed. If set to -1, all posts.
limit = 10
# whether to show the full text content in feed.
fullText = true
# FixIt 0.2.15 | NEW Developer options
# Select the scope named `public_repo` to generate personal access token,
@@ -824,10 +840,10 @@ enableEmoji = true
hiddenFromHomePage = false
# whether to hide a page from search results
hiddenFromSearch = false
# FixIt 0.3.0 | NEW whether to hide a page from RSS feed
hiddenFromRss = false
# FixIt 0.3.0 | NEW whether to hide a page from related posts
hiddenFromRelated = false
# FixIt 0.3.10 | NEW whether to hide a page from RSS, Atom and JSON feed
hiddenFromFeed = false
# whether to enable twemoji
twemoji = false
# FixIt 0.2.18 | CHANGED whether to enable lightgallery
@@ -850,8 +866,6 @@ enableEmoji = true
linkToEdit = true
# FixIt 0.3.0 | NEW whether to show link to report issue for the post
linkToReport = true
# whether to show the full text content in RSS
rssFullText = false
# FixIt 0.3.10 | CHANGED Page style ["narrow", "normal", "wide", ...]
pageStyle = "normal"
# FixIt 0.2.17 | CHANGED Auto Bookmark Support
Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

+46
View File
@@ -0,0 +1,46 @@
{{- if .Site.Params.search.enable -}}
{{- $index := slice -}}
{{- $pages := where .Site.RegularPages "Params.password" "eq" nil -}}
{{- if .Site.Params.page.hiddenFromSearch -}}
{{- $pages = where $pages "Params.hiddenfromsearch" false -}}
{{- else -}}
{{- $pages = where $pages "Params.hiddenfromsearch" "!=" true -}}
{{- end -}}
{{- range $pages -}}
{{- $uri := .RelPermalink -}}
{{- if $.Site.Params.search.absoluteURL -}}
{{- $uri = .Permalink -}}
{{- end -}}
{{- $meta := dict "uri" $uri "title" .Title "tags" .Params.tags "categories" .Params.categories -}}
{{- $meta = $.Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format | dict "date" | merge $meta -}}
{{- with .Description -}}
{{- $index = $index | append (dict "content" . "objectID" $uri | merge $meta) -}}
{{- end -}}
{{- $params := .Params | merge $.Site.Params.page -}}
{{/* Extended Markdown syntax */}}
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{/* Remove line number for code */}}
{{- $content = $content | replaceRE `<span class="lnt?"> *\d*\n?</span>` "" -}}
{{- range $i, $contenti := split $content "<h2 id=" -}}
{{- if gt $i 0 -}}
{{- $contenti = printf "<h2 id=%v" $contenti -}}
{{- end -}}
{{- range $j, $contentj := split $contenti "<h3 id=" -}}
{{- if gt $j 0 -}}
{{- $contentj = printf "<h3 id=%v" $contentj -}}
{{- end -}}
{{/* Plainify, unescape and remove (\n, \t) */}}
{{- $contentj = $contentj | plainify | htmlUnescape | replaceRE `[\n\t ]+` " " -}}
{{- if gt $.Site.Params.search.contentLength 0 -}}
{{- $contentj = substr $contentj 0 $.Site.Params.search.contentLength -}}
{{- end -}}
{{- if $contentj | and (ne $contentj " ") -}}
{{- $one := printf "%v:%v:%v" $uri $i $j | dict "content" $contentj "objectID" | merge $meta -}}
{{- $index = $index | append $one -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $index | jsonify | safeJS -}}
{{- end -}}
+6
View File
@@ -3,6 +3,12 @@
<article class="single summary" itemscope itemtype="http://schema.org/Article">
{{- /* Featured image */ -}}
{{- $image := $params.featuredimagepreview | default $params.featuredimage -}}
{{- with $image }}
{{- if not (hasPrefix . "/") }}
{{- $image = (printf "%s%s" $.RelPermalink .) | safeURL }}
{{- end }}
{{- $image = $image | relURL }}
{{- end }}
{{- with .Resources.GetMatch "featured-image" -}}
{{- $image = .RelPermalink -}}
{{- end -}}
-46
View File
@@ -1,46 +0,0 @@
{{- if .Site.Params.search.enable -}}
{{- $index := slice -}}
{{- $pages := where .Site.RegularPages "Params.password" "eq" nil -}}
{{- if .Site.Params.page.hiddenFromSearch -}}
{{- $pages = where $pages "Params.hiddenfromsearch" false -}}
{{- else -}}
{{- $pages = where $pages "Params.hiddenfromsearch" "!=" true -}}
{{- end -}}
{{- range $pages -}}
{{- $uri := .RelPermalink -}}
{{- if $.Site.Params.search.absoluteURL -}}
{{- $uri = .Permalink -}}
{{- end -}}
{{- $meta := dict "uri" $uri "title" .Title "tags" .Params.tags "categories" .Params.categories -}}
{{- $meta = $.Site.Params.dateFormat | default "2006-01-02" | .PublishDate.Format | dict "date" | merge $meta -}}
{{- with .Description -}}
{{- $index = $index | append (dict "content" . "objectID" $uri | merge $meta) -}}
{{- end -}}
{{- $params := .Params | merge $.Site.Params.page -}}
{{/* Extended Markdown syntax */}}
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{/* Remove line number for code */}}
{{- $content = $content | replaceRE `<span class="lnt?"> *\d*\n?</span>` "" -}}
{{- range $i, $contenti := split $content "<h2 id=" -}}
{{- if gt $i 0 -}}
{{- $contenti = printf "<h2 id=%v" $contenti -}}
{{- end -}}
{{- range $j, $contentj := split $contenti "<h3 id=" -}}
{{- if gt $j 0 -}}
{{- $contentj = printf "<h3 id=%v" $contentj -}}
{{- end -}}
{{/* Plainify, unescape and remove (\n, \t) */}}
{{- $contentj = $contentj | plainify | htmlUnescape | replaceRE `[\n\t ]+` " " -}}
{{- if gt $.Site.Params.search.contentLength 0 -}}
{{- $contentj = substr $contentj 0 $.Site.Params.search.contentLength -}}
{{- end -}}
{{- if $contentj | and (ne $contentj " ") -}}
{{- $one := printf "%v:%v:%v" $uri $i $j | dict "content" $contentj "objectID" | merge $meta -}}
{{- $index = $index | append $one -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $index | jsonify | safeJS -}}
{{- end -}}
-46
View File
@@ -1,46 +0,0 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>
{{- .Site.Title -}}
</title>
<link>
{{- .Permalink -}}
</link>
<description>
{{- .Site.Params.description | default .Site.Title -}}
</description>
<generator>Hugo -- gohugo.io</generator>
{{- with .Site.LanguageCode -}}
<language>
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Params.author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}
<copyright>
{{- . -}}
</copyright>
{{- end -}}
{{- if not .Date.IsZero -}}
<lastBuildDate>
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</lastBuildDate>
{{- end -}}
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{- range .Scratch.Get "mainSectionPages" | first (.Site.Params.home.rss | default 10) -}}
{{- /* TODO 0.4.0 待重构为去掉 `.page` 改用 hugo 推荐的 .Param 方法获取页面参数 */ -}}
{{- $params := .Params | merge site.Params.page -}}
{{- if $params.password | or $params.hiddenFromRss }}{{ continue }}{{ end -}}
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
{{- end -}}
</channel>
</rss>
+1 -1
View File
@@ -16,7 +16,7 @@
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | 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 -}}
{{- else if eq $search.type "fuse" -}}
{{- with .Site.Home.OutputFormats.Get "json" -}}
{{- with .Site.Home.OutputFormats.Get "search" -}}
{{- $config = dict "type" "fuse" "fuseIndexURL" .RelPermalink | dict "search" | merge $config -}}
{{- end -}}
{{- $source := $cdn.fuseJS | default "lib/fuse/fuse.min.js" -}}
+72
View File
@@ -0,0 +1,72 @@
{{- $pages := .Pages -}}
{{- /* Front matter: password */ -}}
{{- $pages = where $pages "Params.password" "eq" nil -}}
{{- /* Front matter: hiddenFromFeed */ -}}
{{- $pages = where $pages "Params.hiddenFromFeed" "ne" true -}}
{{- if ge .Config.limit 1 -}}
{{- $pages = $pages | first .Config.limit -}}
{{- end -}}
{{- $length := $pages.Len -}}
{{- /* TODO 文章内图片链接、分类、标签等处理 */ -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<description>{{ .Site.Params.description | default .Site.Title }}</description>
<generator>Hugo {{ hugo.Version }} &amp; FixIt {{ .Version }}</generator>
<language>{{ .Site.Language.LanguageCode }}</language>{{ with .Site.Params.author.email }}
<managingEditor>{{.}}{{ with $.Site.Params.author.name }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with .Site.Params.author.email }}
<webMaster>{{ . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "rss" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end }}
{{- range $page := $pages }}
{{- $params := .Params | merge .Site.Params.Page }}
{{- $fullText := ((.Params.feed | default dict) | merge $.Config ).fullText }}
{{- $author := partial "function/get-author-map.html" .Params.author }}
{{- $image := $params.featuredimagepreview | default $params.featuredimage }}
{{- with $image }}
{{- if not (hasPrefix . "/") }}
{{- $image = (printf "%s%s" $page.RelPermalink .) | safeURL }}
{{- end }}
{{- $image = $image | absURL }}
{{- end }}
{{- with .Resources.GetMatch "featured-image" }}
{{- $image = .Permalink }}
{{- end }}
{{- with .Resources.GetMatch "featured-image-preview" }}
{{- $image = .Permalink }}
{{- end }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{- with $author.email }}<author>{{ . }}{{ with $author.name }} ({{ . }}){{ end }}</author>{{ end }}
<guid>{{ .Permalink }}</guid>
{{- with .GetTerms "categories" }}
{{- range . }}
<category domain="{{ .Permalink }}">{{ .LinkTitle }}</category>
{{- end }}
{{- end }}
{{- if $fullText }}
<description>
{{- "<![CDATA[" | safeHTML }}
{{- $content := dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" }}
{{- /* {{- $content | replaceRE `<figure[^>]*>.*</figure>` "" | replaceRE `<img[^>]*( /)?>` "" | safeHTML -}} */ -}}
{{- with $image }}
{{- $content = add (printf "<img src=%q alt=%q referrerpolicy=%q>" . "featured image" "no-referrer") $content | safeHTML }}
{{- end }}
{{- $content | transform.XMLEscape | safeHTML }}
{{- "]]>" | safeHTML -}}
</description>
{{- else }}
<description>{{ (.Summary | default .Description | default .Title) | transform.XMLEscape | safeHTML }}</description>
{{- end }}
</item>
{{- end }}
</channel>
</rss>
@@ -0,0 +1,46 @@
{{- /*
Get author in map format.
@param {String|Map} . the author name or map
@returns {Map}
@example {{- $author := partial "function/get-author-map.html" .Params.author -}}
*/ -}}
{{- if not (reflect.IsMap site.Params.author) -}}
{{- errorf "FixIt params error: site.Params.author must be a map, got %T." site.Params.author -}}
{{- end -}}
{{- $default := dict "name" "" "link" "" "email" "" "avatar" "" -}}
{{- $author := site.Params.author | merge $default -}}
{{- $authorParam := dict -}}
{{- if reflect.IsMap . -}}
{{- $authorParam = . -}}
{{- else -}}
{{- with . -}}
{{- $authorParam = dict "name" . -}}
{{- end -}}
{{- end -}}
{{- if isset $authorParam "name" | and (ne $authorParam.name site.Params.author.name) -}}
{{- $author = $authorParam | merge $default | merge $author -}}
{{- else -}}
{{- with $authorParam.link -}}{{ $author = dict "link" . | merge $author }}{{- end -}}
{{- with $authorParam.email -}}{{ $author = dict "email" . | merge $author }}{{- end -}}
{{- with $authorParam.avatar -}}{{ $author = dict "avatar" . | merge $author }}{{- end -}}
{{- end -}}
{{- $gravatar := site.Params.gravatar -}}
{{- if $gravatar.enable | and $author.email -}}
{{- with $gravatar -}}
{{- /* TODO migrate to gravatar */ -}}
{{- $author = dict "avatar" (printf "https://%v/avatar/%v?s=32&d=%v"
(path.Clean .Host | default "www.gravatar.com")
(md5 $author.email)
(.Style | default ""))
| merge $author
-}}
{{- end -}}
{{- end -}}
{{- return $author -}}
+14 -9
View File
@@ -1,5 +1,9 @@
{{- $cdn := .Scratch.Get "cdn" | default dict -}}
{{- $fingerprint := .Scratch.Get "fingerprint" -}}
{{- $title := printf "%s %s %s" .Title .Site.Params.titleDelimiter .Site.Title -}}
{{- if .IsHome -}}
{{- $title = site.Title -}}
{{- end -}}
{{- if not .Site.Params.app.noFavicon -}}
{{- with .Site.Params.app.svgFavicon -}}
@@ -18,17 +22,18 @@
{{- end -}}
{{- end -}}
<link rel="canonical" href="{{ .Permalink }}" />
{{- if .Prev -}}
<link rel="prev" href="{{ .Prev.Permalink }}" />
<link rel="canonical" type="text/html" href="{{ .Permalink }}" title="{{ $title }}" />
{{- with .Prev -}}
<link rel="prev" type="text/html" href="{{ .Permalink }}" title="{{ .Title }}" />
{{- end -}}
{{- if .Next -}}
<link rel="next" href="{{ .Next.Permalink }}" />
{{- with .Next -}}
<link rel="next" type="text/html" href="{{ .Permalink }}" title="{{ .Title }}" />
{{- end -}}
{{- with .OutputFormats.Get "RSS" -}}
<link rel="alternate" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}">
<link rel="feed" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}">
{{- range .AlternativeOutputFormats -}}
{{- printf `<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink $title | safeHTML -}}
{{- end -}}
{{- with .OutputFormats.Get "feed" -}}
<link rel="alternate" type="application/feed+json" href="{{ .Permalink }}" title="{{ $title }}" />
{{- end -}}
{{- /* style.min.css */ -}}
+7 -5
View File
@@ -1,8 +1,7 @@
{{- $params := partial "function/params.html" -}}
{{- $author := partial "function/get-author-map.html" .Params.author -}}
<meta name="author" content="{{ .Site.Params.author.name }}">
<meta name="author-link" content="{{ .Site.Params.author.link }}">
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage | and .Summary }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
<meta name="author" content="{{ $author.name }}">
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ if .IsPage | and .Summary }}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
{{- $keywords := .Keywords -}}
{{- if not $keywords -}}
@@ -13,12 +12,15 @@
{{- end -}}
{{- end -}}
{{- with $keywords -}}
<meta name="keywords" content='{{ delimit . ", " }}' />
<meta name="keywords" content='{{ delimit . ", " }}'>
{{- end -}}
{{- template "_internal/schema.html" . -}}
{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}
{{- with .Site.Params.social.Twitter -}}
<meta name="twitter:creator" content="@{{ . }}" />
{{- end -}}
<meta name="application-name" content="{{ .Site.Params.app.title | default .Site.Title }}">
<meta name="apple-mobile-web-app-title" content="{{ .Site.Params.app.title | default .Site.Title }}">
+1 -1
View File
@@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "v0.3.10-c936e541" -}}
{{- .Scratch.Set "version" "v0.3.10-08d4c12c" -}}
{{- .Scratch.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}
-51
View File
@@ -1,51 +0,0 @@
{{- $params := .Page.Params | merge .Site.Params.Page -}}
{{- $authorName := .Site.Params.author.name | default (T "single.author") -}}
{{- with .Params.author -}}
{{- if reflect.IsMap . -}}
{{- $authorName = cond (isset . "name") .name $authorName -}}
{{- else -}}
{{- $authorName = . -}}
{{- end -}}
{{- end -}}
{{- $image := $params.featuredimagepreview | default $params.featuredimage -}}
{{- with .Page.Resources.GetMatch "featured-image" -}}
{{- $image = .Permalink -}}
{{- end -}}
{{- with .Page.Resources.GetMatch "featured-image-preview" -}}
{{- $image = .Permalink -}}
{{- end -}}
<item>
<title>
{{- .Page.Title -}}
</title>
<link>
{{- .Page.Permalink -}}
</link>
<pubDate>
{{- .Page.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</pubDate>
<author>{{ $authorName }}</author>
<guid>
{{- .Page.Permalink -}}
</guid>
<description>
{{- "<![CDATA[" | safeHTML -}}
{{- with $image -}}
<div class="featured-image">
{{- dict "Src" . "Title" $.Page.Description "Alt" $.Page.Title "Loading" "eager" "Referrerpolicy" "no-referrer" | partial "plugin/image.html" -}}
</div>
{{- end -}}
{{- $content := .Page.Description -}}
{{- if $params.rssFullText -}}
{{- $content = dict "Content" .Page.Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{- else -}}
{{- with .Page.Summary -}}
{{- $content = dict "Content" . "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" -}}
{{- end -}}
{{- end -}}
{{/* {{- $content | replaceRE `<figure[^>]*>.*</figure>` "" | replaceRE `<img[^>]*( /)?>` "" | safeHTML -}} */}}
{{- $content | safeHTML -}}
{{- "]]>" | safeHTML -}}
</description>
</item>
+2 -30
View File
@@ -1,39 +1,11 @@
{{- $params := .Params | merge .Site.Params.page -}}
{{- /* Author data patch */ -}}
{{- $authorDefault := dict "name" "" "link" "" "email" "" "avatar" "" -}}
{{- $author := .Site.Params.author | merge $authorDefault -}}
{{- $authorPost := dict -}}
{{- if reflect.IsMap $params.author -}}
{{- $authorPost = $params.author -}}
{{- else if isset $params "author" -}}
{{- warnf "检测到你的 author 参数格式错误,请参考主题文档设置为正常的格式。" -}}
{{- $authorPost = dict "name" $params.author -}}
{{- end -}}
{{- if isset $authorPost "name" | and (ne $authorPost.name .Site.Params.author.name) -}}
{{- $author = $authorPost | merge $authorDefault | merge $author -}}
{{- else -}}
{{- with $authorPost.link -}}{{ $author = dict "link" . | merge $author }}{{- end -}}
{{- with $authorPost.email -}}{{ $author = dict "email" . | merge $author }}{{- end -}}
{{- with $authorPost.avatar -}}{{ $author = dict "avatar" . | merge $author }}{{- end -}}
{{- end -}}
{{- $gravatar := .Site.Params.gravatar -}}
{{- if $gravatar.enable | and $author.email -}}
{{- with $gravatar -}}
{{- $author = dict "avatar" (printf "https://%v/avatar/%v?s=32&d=%v"
(path.Clean .Host | default "www.gravatar.com")
(md5 $author.email)
(.Style | default ""))
| merge $author
-}}
{{- end -}}
{{- end -}}
{{- $author := partial "function/get-author-map.html" .Params.author -}}
{{- .Store.Set "author" $author -}}
<span class="post-author">
{{- $content := $author.name | default "Anonymous" -}}
{{- $icon := dict "Class" "fa-solid fa-user-circle" -}}
{{- /* Deprecate $params.authorAvatar in favor of $params.showAvatar and dd front matter gravatar {bool} */ -}}
{{- if $author.avatar | and $params.authorAvatar -}}
{{- $content = printf "%v&nbsp;%v" (dict "Src" $author.avatar "Class" "avatar" "Alt" $content "Width" 20 "Height" 20 | partial "plugin/image.html") $content -}}
{{- $icon = "" -}}
-56
View File
@@ -1,56 +0,0 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>
{{- title (.Params.Title | default ((T .Section) | default .Section | dict "Some" | T "allSome")) -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
</title>
<link>
{{- .Permalink -}}
</link>
<description>
{{- title (.Params.Title | default ((T .Section) | default .Section | dict "Some" | T "allSome")) }} | {{ .Site.Title -}}
</description>
<generator>Hugo -- gohugo.io</generator>
{{- with .Site.LanguageCode -}}
<language>
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Params.author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}
<copyright>
{{- . -}}
</copyright>
{{- end -}}
{{- if not .Date.IsZero -}}
<lastBuildDate>
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</lastBuildDate>
{{- end -}}
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
{{- if .Site.Params.section.recentlyUpdated.rss -}}
{{- $postCount := 0 -}}
{{- $maxPostCount := .Site.Params.section.recentlyUpdated.maxCount | default 10 -}}
{{- $days := .Site.Params.section.recentlyUpdated.days | default 30 -}}
{{- range (where .Data.Pages.ByLastmod.Reverse "Section" "!=" "") -}}
{{- if gt (add .Lastmod.Unix (mul 86900 $days)) now.Unix -}}
{{- if lt $postCount $maxPostCount -}}
{{- if ne .Lastmod.Unix .Date.Unix }}
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- range .Pages | first (.Site.Params.section.rss | default 10) -}}
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
{{- end -}}
</channel>
</rss>
+4
View File
@@ -0,0 +1,4 @@
{{- $options := dict "Site" .Site "Config" .Site.Params.feed "OutputFormats" .OutputFormats -}}
{{- $options = dict "Permalink" .Permalink "Version" (.Scratch.Get "version") | merge $options -}}
{{- $options = dict "Title" .Site.Title "Pages" (.Scratch.Get "mainSectionPages") | merge $options -}}
{{- partial "feed/rss.html" $options -}}
+9
View File
@@ -0,0 +1,9 @@
{{- $title := title (.Params.Title | default ((T .Section) | default .Section | dict "Some" | T "allSome")) -}}
{{- if .Site.Params.withSiteTitle -}}
{{- $title = printf "%s %s %s" $title .Site.Params.titleDelimiter .Site.Title -}}
{{- end -}}
{{- $config := (.Params.feed | default dict) | merge .Site.Params.section.feed | merge .Site.Params.feed -}}
{{- $options := dict "Site" .Site "Config" $config "OutputFormats" .OutputFormats -}}
{{- $options = dict "Permalink" .Permalink "Version" (.Scratch.Get "version") | merge $options -}}
{{- $options = dict "Title" $title "Pages" .Pages | merge $options -}}
{{- partial "feed/rss.html" $options -}}
+9 -42
View File
@@ -1,42 +1,9 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular -}}
{{- if .Site.Params.withSiteTitle }} {{ .Site.Params.titleDelimiter }} {{ .Site.Title }}{{- end -}}
</title>
<link>
{{- .Permalink -}}
</link>
<description>
{{- .Title }} - {{ T .Data.Singular | default .Data.Singular }} | {{ .Site.Title -}}
</description>
<generator>Hugo -- gohugo.io</generator>
{{- with .Site.LanguageCode -}}
<language>
{{- . -}}
</language>
{{- end -}}
{{- with .Site.Params.author.email -}}
<managingEditor>
{{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
</managingEditor>
<webMaster>
{{- . }}{{ with $.Site.Params.author.name }} ({{ . }}){{ end -}}
</webMaster>
{{- end -}}
{{- with .Site.Copyright -}}
<copyright>
{{- . -}}
</copyright>
{{- end -}}
{{- if not .Date.IsZero -}}
<lastBuildDate>
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</lastBuildDate>
{{- end -}}
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
{{- range .Pages | first (.Site.Params.list.rss | default 10) -}}
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
{{- end -}}
</channel>
</rss>
{{- $title := printf "%s - %s" .Title (T .Data.Singular | default .Data.Singular) -}}
{{- if .Site.Params.withSiteTitle -}}
{{- $title = printf "%s %s %s" $title .Site.Params.titleDelimiter .Site.Title -}}
{{- end -}}
{{- $config := (.Params.feed | default dict) | merge .Site.Params.list.feed | merge .Site.Params.feed -}}
{{- $options := dict "Site" .Site "Config" $config "OutputFormats" .OutputFormats -}}
{{- $options = dict "Permalink" .Permalink "Version" (.Scratch.Get "version") | merge $options -}}
{{- $options = dict "Title" $title "Pages" .Pages | merge $options -}}
{{- partial "feed/rss.html" $options -}}