Add rss feed

Signed-off-by: Harry Chen <i@harrychen.xyz>
This commit is contained in:
Harry Chen 2021-08-03 21:39:30 +08:00
parent 964cb707d4
commit a20b5f5027
No known key found for this signature in database
GPG Key ID: 9F98D3E7C18D0378
4 changed files with 96 additions and 1 deletions

View File

@ -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

View File

@ -3,7 +3,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
{% 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 %}
<meta name="description" content="{{ page_desc }}">

26
feed.xml Normal file
View File

@ -0,0 +1,26 @@
---
---
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="{{ "/static/css/rss.css" | prepend: site.baseurl }}" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ site.title | xml_escape }}</title>
{% capture desc %}{{ site.title }}{{ site.desc }}{% endcapture %}
<description>{{ desc | xml_escape }}</description>
<link>{{ site.url }}{{ site.baseurl }}/</link>
<atom:link href="{{ "/feed.xml" | prepend: site.baseurl | prepend: site.url }}" rel="self" type="application/rss+xml" />
<pubDate>{{ site.time | date_to_rfc822 }}</pubDate>
<lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate>
<generator>Jekyll v{{ jekyll.version }}</generator>
{% for post in site.categories["news"] limit:20 %}
<item>
<title>{{ post.title | xml_escape }}</title>
<description>{{ post.content | xml_escape }}</description>
{% if post.author %}<author>{{ post.author }}</author>{% endif %}
<pubDate>{{ post.date | date_to_rfc822 }}</pubDate>
<link>{{ post.url | prepend: site.baseurl | prepend: site.url }}</link>
<guid isPermaLink="true">{{ post.url | prepend: site.baseurl | prepend: site.url }}</guid>
</item>
{% endfor %}
</channel>
</rss>

68
static/css/rss.css Normal file
View File

@ -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;
}