Skip to content

Commit

Permalink
feat(rss): add rssFullText param for RSS (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonzq authored May 1, 2020
1 parent 5b689bf commit e3e3bdf
Show file tree
Hide file tree
Showing 32 changed files with 113 additions and 127 deletions.
3 changes: 2 additions & 1 deletion assets/css/_partial/_single/_toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
@include overflow-wrap(break-word);
box-sizing: border-box;
top: if($header-normal-mode-desktop, 5rem, 10rem);
left: $MAX_LENGTH;
left: 0;
visibility: hidden;

@include blur;

Expand Down
2 changes: 1 addition & 1 deletion assets/js/theme.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/theme.min.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,9 @@ enableEmoji = true
# whether to show link to Raw Markdown content of the content
# 是否显示原始 Markdown 文档内容的链接
linkToMarkdown = true
# whether to show the full text content in RSS
# 是否在 RSS 中显示全文内容
rssFullText = false
# Table of the contents config
# 目录配置
[params.page.toc]
Expand Down
2 changes: 2 additions & 0 deletions exampleSite/content/posts/theme-documentation-basics.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ Please open the code block below to view the complete sample configuration :(far
fontawesome = true
# whether to show link to Raw Markdown content of the content
linkToMarkdown = true
# {{< version 0.2.4 >}} whether to show the full text content in RSS
rssFullText = false
# {{< version 0.2.0 >}} Table of the contents config
[params.page.toc]
# whether to enable the table of the contents
Expand Down
2 changes: 2 additions & 0 deletions exampleSite/content/posts/theme-documentation-basics.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ Please open the code block below to view the complete sample configuration :(far
fontawesome = true
# whether to show link to Raw Markdown content of the content
linkToMarkdown = true
# {{< version 0.2.4 >}} whether to show the full text content in RSS
rssFullText = false
# {{< version 0.2.0 >}} Table of the contents config
[params.page.toc]
# whether to enable the table of the contents
Expand Down
2 changes: 2 additions & 0 deletions exampleSite/content/posts/theme-documentation-basics.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ hugo
fontawesome = true
# 是否在文章页面显示原始 Markdown 文档链接
linkToMarkdown = true
# {{< version 0.2.4 >}} 是否在 RSS 中显示全文内容
rssFullText = false
# {{< version 0.2.0 >}} 目录配置
[params.page.toc]
# 是否使用目录
Expand Down
4 changes: 3 additions & 1 deletion exampleSite/content/posts/theme-documentation-content.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ ruby: true
fraction: true
fontawesome: true
linkToMarkdown: true
rssFullText: false

toc:
enable: true
Expand Down Expand Up @@ -112,7 +113,8 @@ comment:
* **ruby**: {{< version 0.2.0 >}} if `true`, the content will enable the [ruby extended syntax](#ruby).
* **fraction**: {{< version 0.2.0 >}} if `true`, the content will enable the [fraction extended syntax](#fraction).
* **fontawesome**: {{< version 0.2.0 >}} if `true`, the content will enable the [Font Awesome extended syntax](#fontawesome).
* **linkToMarkdown**: if `true`, the footer of the content will show the link to the orignal Markdown file.
* **linkToMarkdown**: if `true`, the footer of the content will be shown the link to the orignal Markdown file.
* **rssFullText**: {{< version 0.2.4 >}} if `true`, the full text content will be shown in RSS.

* **toc**: {{< version 0.2.0 changed >}} the same as the `params.page.toc` part in the [site configuration](../theme-documentation-basics#site-configuration).
* **code**: {{< version 0.2.0 >}} the same as the `params.page.code` part in the [site configuration](../theme-documentation-basics#site-configuration).
Expand Down
4 changes: 3 additions & 1 deletion exampleSite/content/posts/theme-documentation-content.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ ruby: true
fraction: true
fontawesome: true
linkToMarkdown: true
rssFullText: false

toc:
enable: true
Expand Down Expand Up @@ -117,7 +118,8 @@ comment:
* **ruby**: {{< version 0.2.0 >}} if `true`, the content will enable the [ruby extended syntax](#ruby).
* **fraction**: {{< version 0.2.0 >}} if `true`, the content will enable the [fraction extended syntax](#fraction).
* **fontawesome**: {{< version 0.2.0 >}} if `true`, the content will enable the [Font Awesome extended syntax](#fontawesome).
* **linkToMarkdown**: if `true`, the footer of the content will show the link to the orignal Markdown file.
* **linkToMarkdown**: if `true`, the footer of the content will be shown the link to the orignal Markdown file.
* **rssFullText**: {{< version 0.2.4 >}} if `true`, the full text content will be shown in RSS.

* **toc**: {{< version 0.2.0 changed >}} the same as the `params.page.toc` part in the [site configuration](../theme-documentation-basics#site-configuration).
* **code**: {{< version 0.2.0 >}} the same as the `params.page.code` part in the [site configuration](../theme-documentation-basics#site-configuration).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ ruby: true
fraction: true
fontawesome: true
linkToMarkdown: true
rssFullText: false

toc:
enable: true
Expand Down Expand Up @@ -113,6 +114,7 @@ comment:
* **fraction**: {{< version 0.2.0 >}} 如果设为 `true`, 这篇文章会使用 [分数扩展语法](#fraction).
* **fontawesome**: {{< version 0.2.0 >}} 如果设为 `true`, 这篇文章会使用 [Font Awesome 扩展语法](#fontawesome).
* **linkToMarkdown**: 如果设为 `true`, 内容的页脚将显示指向原始 Markdown 文件的链接.
* **rssFullText**: {{< version 0.2.4 >}} 如果设为 `true`, 在 RSS 中将会显示全文内容.

* **toc**: {{< version 0.2.0 changed >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.toc` 部分相同.
* **code**: {{< version 0.2.0 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.code` 部分相同.
Expand Down
4 changes: 2 additions & 2 deletions layouts/_default/_markup/render-image.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- with .Title -}}
<figure>
{{- partial "plugin/image.html" (dict "src" $.Destination "alt" $.Text "caption" . "linked" true) -}}
{{- dict "src" $.Destination "alt" $.Text "caption" . "linked" true | partial "plugin/image.html" -}}
<figcaption class="image-caption">
{{- . | safeHTML -}}
</figcaption>
</figure>
{{- else -}}
{{- partial "plugin/image.html" (dict "src" .Destination "alt" .Text) -}}
{{- dict "src" .Destination "alt" .Text | partial "plugin/image.html" -}}
{{- end -}}
2 changes: 1 addition & 1 deletion layouts/_default/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="featured-image-preview">
<a href="{{ $.RelPermalink }}">
{{- $image := $params.featuredimagepreview | default . -}}
{{- partial "plugin/image.html" (dict "src" $image "alt" $.Description "large" true) -}}
{{- dict "src" $image "alt" $.Description "large" true | partial "plugin/image.html" -}}
</a>
</div>
{{- end -}}
Expand Down
25 changes: 1 addition & 24 deletions layouts/index.rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,7 @@
{{- end -}}
<atom:link href="{{ .Permalink }}" rel="self" type="application/rss+xml" />
{{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}}
<item>
<title>
{{- .Title -}}
</title>
<link>
{{- .Permalink -}}
</link>
<pubDate>
{{- .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}
</pubDate>
<author>
{{- .Params.author | default $.Site.Author.name | default (T "author") -}}
</author>
<guid>
{{- .Permalink -}}
</guid>
<description>
{{- with .Summary -}}
{{- dict "content" . "ruby" true "fraction" true "fontawesome" true | partial "function/content.html" | plainify -}}
{{- else -}}
{{- .Description | plainify -}}
{{- end -}}
</description>
</item>
{{- dict "page" . "site" .Site | partial "rss/item.html" -}}
{{- end -}}
</channel>
</rss>
2 changes: 1 addition & 1 deletion layouts/partials/assets.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
</script>

{{- /* Polyfill.io */ -}}
{{- partial "plugin/script.html" (dict "source" "https://polyfill.io/v3/polyfill.min.js?features=Element.prototype.closest%2CrequestAnimationFrame%2CCustomEvent%2CPromise%2CObject.entries%2CObject.assign%2CObject.values%2Cfetch%2CElement.prototype.after%2CArray.prototype.fill%2CIntersectionObserver%2CArray.from%2CArray.prototype.find%2CMath.sign") -}}
{{- dict "source" "https://polyfill.io/v3/polyfill.min.js?features=Element.prototype.closest%2CrequestAnimationFrame%2CCustomEvent%2CPromise%2CObject.entries%2CObject.assign%2CObject.values%2Cfetch%2CElement.prototype.after%2CArray.prototype.fill%2CIntersectionObserver%2CArray.from%2CArray.prototype.find%2CMath.sign" | partial "plugin/script.html" -}}

{{- range (.Scratch.Get "this").script -}}
{{- partial "plugin/script.html" . -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
{{- with .Site.Params.header.title -}}
{{- with .logo -}}
{{- partial "plugin/image.html" (dict "src" . "alt" $.Site.Title "class" "logo") -}}
{{- dict "src" . "alt" $.Site.Title "class" "logo" | partial "plugin/image.html" -}}
{{- end -}}
{{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span>
Expand Down Expand Up @@ -83,7 +83,7 @@
<a href="{{ .Site.Home.RelPermalink }}" title="{{ .Site.Title }}">
{{- with .Site.Params.header.title -}}
{{- with .logo -}}
{{- partial "plugin/image.html" (dict "src" . "alt" $.Site.Title "class" "logo") -}}
{{- dict "src" . "alt" $.Site.Title "class" "logo" | partial "plugin/image.html" -}}
{{- end -}}
{{- with .pre -}}
<span class="header-title-pre">{{ . | safeHTML }}</span>
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/home/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
{{- with $avatar -}}
<div class="home-avatar">
<a href="/posts" title="{{ T `home` }}">
{{- partial "plugin/image.html" (dict "src" . "alt" (T "home")) -}}
{{- dict "src" . "alt" (T "home") | partial "plugin/image.html" -}}
</a>
</div>
{{- end -}}

{{- with .Site.Params.home.profile.subtitle -}}
<h2 class="home-subtitle">
{{- if $.Site.Params.home.profile.typeit -}}
{{- $id := partial "function/id.html" (dict "content" . "scratch" $.Scratch) -}}
{{- $id := dict "content" . "scratch" $.Scratch | partial "function/id.html" -}}
<div id="{{ $id }}" class="typeit"></div>
{{- dict $id (slice $id) | dict "typeitMap" | merge ($.Scratch.Get "this") | $.Scratch.Set "this" -}}
{{- else -}}
Expand Down
8 changes: 4 additions & 4 deletions layouts/partials/plugin/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<img
class="lazyload{{ with .class }} {{ . }}{{ end }}"
src="{{ $loading.RelPermalink }}"
data-sizes="auto"
data-srcset="{{ $small | relURL }}, {{ .src | relURL }} 1.5x, {{ $large | relURL }} 2x"
data-src="{{ .src | relURL }}"
data-srcset="{{ $small | relURL }}, {{ .src | relURL }} 1.5x, {{ $large | relURL }} 2x"
data-sizes="auto"
alt="{{ $alt }}"{{ with .height }} height="{{ . }}"{{ end }}{{ with .width }} width="{{ . }}"{{ end }} />
</a>
{{- else -}}
Expand All @@ -20,9 +20,9 @@
<img
class="lazyload{{ with .class }} {{ . }}{{ end }}"
src="{{ $loading.RelPermalink }}"
data-sizes="auto"
data-srcset="{{ $small | relURL }}, {{ .src | relURL }} 1.5x, {{ $large | relURL }} 2x"
data-src="{{ .src | relURL }}"
data-srcset="{{ $small | relURL }}, {{ .src | relURL }} 1.5x, {{ $large | relURL }} 2x"
data-sizes="auto"
alt="{{ $alt }}"
title="{{ .title | default $alt }}"{{ with .height }} height="{{ . }}"{{ end }}{{ with .width }} width="{{ . }}"{{ end }} />
{{- end -}}
Loading

0 comments on commit e3e3bdf

Please sign in to comment.