make it possible to link to # fragments in [page:meow] links, like [page:meow#purrrr]
This commit is contained in:
parent
31e99f3137
commit
ab4d77780e
1 changed files with 7 additions and 1 deletions
|
@ -151,9 +151,15 @@ impl Config {
|
|||
}
|
||||
|
||||
pub fn page_url(&self, page: &str) -> String {
|
||||
let (page, hash) = page.split_once('#').unwrap_or((page, ""));
|
||||
|
||||
// We don't want .dj appearing in URLs, though it exists as a disambiguator in [page:] links.
|
||||
let page = page.strip_suffix(".dj").unwrap_or(page);
|
||||
format!("{}/{}", self.site, page)
|
||||
if !hash.is_empty() {
|
||||
format!("{}/{page}#{hash}", self.site)
|
||||
} else {
|
||||
format!("{}/{page}", self.site)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pic_url(&self, pics_dir: &dyn Dir, id: &str) -> String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue