use site_title in feeds
This commit is contained in:
parent
81993fe829
commit
035bc89310
2 changed files with 5 additions and 3 deletions
|
@ -9,6 +9,7 @@ use crate::{page::Page, tag::Tag, AppState};
|
||||||
struct FeedContext<'a> {
|
struct FeedContext<'a> {
|
||||||
feed_url: &'a str,
|
feed_url: &'a str,
|
||||||
base_url: &'a str,
|
base_url: &'a str,
|
||||||
|
site_title: &'a str,
|
||||||
last_updated: &'a str,
|
last_updated: &'a str,
|
||||||
tag: Option<&'a Tag>,
|
tag: Option<&'a Tag>,
|
||||||
posts: &'a [&'a Page],
|
posts: &'a [&'a Page],
|
||||||
|
@ -30,6 +31,7 @@ pub fn render_atom_feed(state: &AppState) -> Result<String> {
|
||||||
let feed = FeedContext {
|
let feed = FeedContext {
|
||||||
feed_url: &format!("{}atom.xml", state.base_url),
|
feed_url: &format!("{}atom.xml", state.base_url),
|
||||||
base_url: &state.base_url.to_string(),
|
base_url: &state.base_url.to_string(),
|
||||||
|
site_title: &state.settings.title,
|
||||||
last_updated: &updated.map_or_else(String::default, |d| d.to_rfc3339()),
|
last_updated: &updated.map_or_else(String::default, |d| d.to_rfc3339()),
|
||||||
tag: None,
|
tag: None,
|
||||||
posts: &posts,
|
posts: &posts,
|
||||||
|
@ -57,6 +59,7 @@ pub fn render_atom_tag_feed(tag: &Tag, state: &AppState) -> Result<String> {
|
||||||
let feed = FeedContext {
|
let feed = FeedContext {
|
||||||
feed_url: &format!("{}tags/{}/atom.xml", state.base_url, slug),
|
feed_url: &format!("{}tags/{}/atom.xml", state.base_url, slug),
|
||||||
base_url: &state.base_url.to_string(),
|
base_url: &state.base_url.to_string(),
|
||||||
|
site_title: &state.settings.title,
|
||||||
last_updated: &updated.map_or_else(String::default, |d| d.to_rfc3339()),
|
last_updated: &updated.map_or_else(String::default, |d| d.to_rfc3339()),
|
||||||
tag: Some(tag),
|
tag: Some(tag),
|
||||||
posts: &posts,
|
posts: &posts,
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
|
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
|
||||||
<title>tollyx.net
|
<title>{{ site_title }}
|
||||||
{%- if tag %} - #{{ tag.slug }}{% endif -%}
|
{%- if tag %} - #{{ tag.slug }}{% endif -%}
|
||||||
</title>
|
</title>
|
||||||
<subtitle>tollyx's corner of the web</subtitle>
|
|
||||||
<link href="{{ feed_url | safe }}" rel="self" type="application/atom+xml"/>
|
<link href="{{ feed_url | safe }}" rel="self" type="application/atom+xml"/>
|
||||||
{% if tag -%}
|
{% if tag -%}
|
||||||
<link href="{{ base_url | safe }}tags/{{ tag.slug }}/"/>
|
<link href="{{ base_url | safe }}tags/{{ tag.slug }}/"/>
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
<link href="{{ base_url | safe }}"/>
|
<link href="{{ base_url | safe }}"/>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
<generator uri="{{ base_url | safe }}">tollyx-website</generator>
|
<generator uri="{{ base_url | safe }}">tlxite</generator>
|
||||||
<updated>{{ last_updated | date(format="%+") }}</updated>
|
<updated>{{ last_updated | date(format="%+") }}</updated>
|
||||||
<id>{{ feed_url | safe }}</id>
|
<id>{{ feed_url | safe }}</id>
|
||||||
{%- for post in posts %}
|
{%- for post in posts %}
|
||||||
|
|
Loading…
Reference in a new issue