From a20b5f502721b81756ed852f3526acf8d931ce1f Mon Sep 17 00:00:00 2001 From: Harry Chen Date: Tue, 3 Aug 2021 21:39:30 +0800 Subject: [PATCH] Add rss feed Signed-off-by: Harry Chen --- _config.yml | 1 + _includes/head.html | 2 +- feed.xml | 26 +++++++++++++++++ static/css/rss.css | 68 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 feed.xml create mode 100644 static/css/rss.css diff --git a/_config.yml b/_config.yml index 1845270..bc942de 100644 --- a/_config.yml +++ b/_config.yml @@ -13,6 +13,7 @@ school: 清华大学 brand: Tsinghua Open Source Mirror operator: 清华大学信息化技术中心 author: Tsinghua University TUNA Association +desc: 致力于为国内和校内用户提供高质量的开源软件镜像、Linux 镜像源服务,帮助用户更方便地获取开源软件。本镜像站由清华大学 TUNA 协会负责运行维护。 # operator: 北外信息技术中心 logo: true meow_404: true diff --git a/_includes/head.html b/_includes/head.html index ff4f843..e50f4fb 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -3,7 +3,7 @@ -{% capture page_desc %}{% if include.metaDesc %}{{ include.metaDesc }} | {% if include.cattitle %}{{ include.cattitle }} | {% endif %}{% endif %}{{ site.title }},致力于为国内和校内用户提供高质量的开源软件镜像、Linux 镜像源服务,帮助用户更方便地获取开源软件。本镜像站由清华大学 TUNA 协会负责运行维护。{% endcapture %} +{% capture page_desc %}{% if include.metaDesc %}{{ include.metaDesc }} | {% if include.cattitle %}{{ include.cattitle }} | {% endif %}{% endif %}{{ site.title }},{{ site.desc }}{% endcapture %} {% capture page_title %}{% if page.mirrorid %} {{ page.mirrorid }} |{% elsif page.title %} {{ page.title }} |{% endif %}{% if include.cattitle %} {{ include.cattitle }} |{% endif %}{% if (page.title or include.cattitle) %}{{" "}}{% endif %}{{ site.title }}{% if site.brand %} | {{ site.brand }}{% endif %}{% endcapture %} diff --git a/feed.xml b/feed.xml new file mode 100644 index 0000000..c6a10b8 --- /dev/null +++ b/feed.xml @@ -0,0 +1,26 @@ +--- +--- + + + + + {{ site.title | xml_escape }} + {% capture desc %}{{ site.title }},{{ site.desc }}{% endcapture %} + {{ desc | xml_escape }} + {{ site.url }}{{ site.baseurl }}/ + + {{ site.time | date_to_rfc822 }} + {{ site.time | date_to_rfc822 }} + Jekyll v{{ jekyll.version }} + {% for post in site.categories["news"] limit:20 %} + + {{ post.title | xml_escape }} + {{ post.content | xml_escape }} + {% if post.author %}{{ post.author }}{% endif %} + {{ post.date | date_to_rfc822 }} + {{ post.url | prepend: site.baseurl | prepend: site.url }} + {{ post.url | prepend: site.baseurl | prepend: site.url }} + + {% endfor %} + + \ No newline at end of file diff --git a/static/css/rss.css b/static/css/rss.css new file mode 100644 index 0000000..4dde83e --- /dev/null +++ b/static/css/rss.css @@ -0,0 +1,68 @@ +* { + padding: 0px; + margin: 0px; + display: block; +} +rss { + display: block; + font-family: sans-serif; + background-color: #f2f2f2; + color: #222222; + font-size: 13px; +} +channel > title { + font-size: 24px; + font-weight: bold; + margin: 10px 0px; +} +channel { + width: 728px; + margin-left: auto; + margin-right: auto; +} +channel > item { + background-color: #ffffff; + border: 1px solid #d8d8d8; + padding: 20px; + margin-bottom: 15px; +} + item > link, item > pubDate { + color: #888888; + font-size: 12px; + border-bottom: 1px solid #f0f0f0; + margin-bottom: 5px; + padding-bottom: 5px; + } + item > link { + float: right; + text-align: right; + width: 66.66%; + } + item > pubDate { + float: left; + width: 33.33%; + } + item > title { + color: #00579B; + font-size: 18px; + margin-bottom: 5px; + } + item > description { + margin-bottom: 10px; + } + item > category { + background-color: #efefef; + border: 1px solid #dadada; + border-radius: 3px; + padding: 2px 4px; + display: inline-block; + color: #888888; + transition: color 0.3s linear; + } + item > category:hover { + color: #222222; + } + +lastBuildDate, language, guid, channel > link { + display: none; +} \ No newline at end of file