1
0
Fork 0

fix tag feed rel link

This commit is contained in:
Adrian Hedqvist 2023-04-03 23:49:16 +02:00
parent 4ed0341a69
commit b3f7737735
2 changed files with 6 additions and 5 deletions

View file

@ -22,14 +22,14 @@ pub fn router() -> Router<Arc<AppState>> {
}
#[derive(Serialize, Debug)]
struct PageContext<'a> {
struct TagContext<'a> {
title: &'a str,
}
#[instrument(skip(state))]
pub async fn index(State(state): State<Arc<AppState>>) -> Result<Html<String>, WebsiteError> {
let tags: Vec<_> = state.tags.values().collect();
let ctx = PageContext { title: "Tags" };
let ctx = TagContext { title: "Tags" };
let mut c = tera::Context::new();
c.insert("page", &ctx);
@ -56,9 +56,10 @@ pub async fn view(
let title = format!("Posts tagged with #{tag}");
let ctx = PageContext { title: &title };
let ctx = TagContext { title: &title };
let mut c = tera::Context::new();
c.insert("tag_slug", &tag);
c.insert("page", &ctx);
c.insert("posts", &posts);

View file

@ -3,8 +3,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="alternate" type="application/rss+xml" href="https://tollyx.net/atom.xml" title="tollyx.net">
{% if tag -%}
<link rel="alternate" type="application/rss+xml" href="https://tollyx.net/tags/{{ tag.slug }}/atom.xml" title="tollyx.net - #{{ tag.slug }}">
{% if tag_slug -%}
<link rel="alternate" type="application/rss+xml" href="https://tollyx.net/tags/{{ tag_slug }}/atom.xml" title="tollyx.net: Posts tagged #{{ tag_slug }}">
{%- endif %}
<link rel="stylesheet" href="/static/site.css">
<link rel="icon" type="image/png" href="/static/avatar.png" />