Allow customizing feed path
This commit is contained in:
parent
dce49028df
commit
925ee721fd
3 changed files with 17 additions and 2 deletions
|
@ -7,6 +7,10 @@ import gloss/utils/date.{type Month}
|
||||||
|
|
||||||
pub const default_index = "/index"
|
pub const default_index = "/index"
|
||||||
|
|
||||||
|
pub const default_feed_file = "/feed.xml"
|
||||||
|
|
||||||
|
pub const default_feed = default_feed_file
|
||||||
|
|
||||||
pub type PathConfiguration {
|
pub type PathConfiguration {
|
||||||
PathConfiguration(
|
PathConfiguration(
|
||||||
index: String,
|
index: String,
|
||||||
|
@ -17,6 +21,8 @@ pub type PathConfiguration {
|
||||||
month: fn(Int, Month) -> String,
|
month: fn(Int, Month) -> String,
|
||||||
list_page: fn(String, Int) -> String,
|
list_page: fn(String, Int) -> String,
|
||||||
html: fn(String) -> String,
|
html: fn(String) -> String,
|
||||||
|
feed: String,
|
||||||
|
feed_file: String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +35,8 @@ pub const defaults = PathConfiguration(
|
||||||
month: default_month_archive,
|
month: default_month_archive,
|
||||||
list_page: default_list_page,
|
list_page: default_list_page,
|
||||||
html: default_html,
|
html: default_html,
|
||||||
|
feed: default_feed,
|
||||||
|
feed_file: default_feed_file,
|
||||||
)
|
)
|
||||||
|
|
||||||
pub fn default_single_post(post: Post) {
|
pub fn default_single_post(post: Post) {
|
||||||
|
|
|
@ -9,7 +9,9 @@ import lustre/element/html.{
|
||||||
a, body, footer, h1, head, header, html, li, link, main, meta, nav, p, section,
|
a, body, footer, h1, head, header, html, li, link, main, meta, nav, p, section,
|
||||||
title, ul,
|
title, ul,
|
||||||
}
|
}
|
||||||
import lustre/attribute.{attribute, href, id, name, rel, role, style, value}
|
import lustre/attribute.{
|
||||||
|
attribute, href, id, name, rel, role, style, type_, value,
|
||||||
|
}
|
||||||
import gloss/models/database.{type Database}
|
import gloss/models/database.{type Database}
|
||||||
import gloss/models/menu.{type MenuItem}
|
import gloss/models/menu.{type MenuItem}
|
||||||
import gloss/utils/ordered_tree
|
import gloss/utils/ordered_tree
|
||||||
|
@ -60,6 +62,11 @@ fn view(
|
||||||
link([href("/css/normalize.css"), rel("stylesheet")]),
|
link([href("/css/normalize.css"), rel("stylesheet")]),
|
||||||
link([href("/css/magick.css"), rel("stylesheet")]),
|
link([href("/css/magick.css"), rel("stylesheet")]),
|
||||||
link([href("/css/custom.css"), rel("stylesheet")]),
|
link([href("/css/custom.css"), rel("stylesheet")]),
|
||||||
|
link([
|
||||||
|
href(config.paths.feed),
|
||||||
|
rel("alternate"),
|
||||||
|
type_("application/atom+xml"),
|
||||||
|
]),
|
||||||
case config.author.url {
|
case config.author.url {
|
||||||
option.Some(url) -> link([rel("me"), value(url)])
|
option.Some(url) -> link([rel("me"), value(url)])
|
||||||
_ -> element.none()
|
_ -> element.none()
|
||||||
|
|
|
@ -71,7 +71,7 @@ pub fn write(db: RenderDatabase, path_conf: PathConfiguration) {
|
||||||
let site =
|
let site =
|
||||||
ssg.add_static_asset(
|
ssg.add_static_asset(
|
||||||
site,
|
site,
|
||||||
"/feed.xml",
|
path_conf.feed_file,
|
||||||
element.to_string(xml.declaration()) <> element.to_string(db.feed),
|
element.to_string(xml.declaration()) <> element.to_string(db.feed),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue