This commit is contained in:
parent
fddef30bad
commit
81ebbb97ff
1 changed files with 3 additions and 3 deletions
|
@ -23,7 +23,7 @@ use crate::{
|
||||||
template::Infos,
|
template::Infos,
|
||||||
};
|
};
|
||||||
|
|
||||||
const MIME_TYPE: &str = "application/rss+xml";
|
const MIME_TYPE_RSS: &str = "application/rss+xml";
|
||||||
|
|
||||||
#[get("/blog")]
|
#[get("/blog")]
|
||||||
pub async fn index(config: web::Data<Config>) -> impl Responder {
|
pub async fn index(config: web::Data<Config>) -> impl Responder {
|
||||||
|
@ -179,7 +179,7 @@ fn get_post(post: &mut Option<File>, filename: String) -> Infos {
|
||||||
#[get("/blog/rss")]
|
#[get("/blog/rss")]
|
||||||
pub async fn rss(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
|
pub async fn rss(req: HttpRequest, config: web::Data<Config>) -> impl Responder {
|
||||||
HttpResponse::Ok()
|
HttpResponse::Ok()
|
||||||
.append_header(("content-type", MIME_TYPE))
|
.append_header(("content-type", MIME_TYPE_RSS))
|
||||||
.body(build_rss(
|
.body(build_rss(
|
||||||
config.get_ref().to_owned(),
|
config.get_ref().to_owned(),
|
||||||
req.connection_info().to_owned(),
|
req.connection_info().to_owned(),
|
||||||
|
@ -263,7 +263,7 @@ fn build_rss(config: Config, info: ConnectionInfo) -> String {
|
||||||
href: format!("{}/blog/rss", link_to_site),
|
href: format!("{}/blog/rss", link_to_site),
|
||||||
rel: "self".into(),
|
rel: "self".into(),
|
||||||
hreflang: Some(lang.into()),
|
hreflang: Some(lang.into()),
|
||||||
mime_type: Some(MIME_TYPE.into()),
|
MIME_TYPE_RSS: Some(MIME_TYPE_RSS.into()),
|
||||||
title: Some(title.to_owned()),
|
title: Some(title.to_owned()),
|
||||||
length: None,
|
length: None,
|
||||||
}],
|
}],
|
||||||
|
|
Loading…
Reference in a new issue