Added a redirect map to the HTML config
This commit is contained in:
parent
6c4c3448e3
commit
a5086a1e58
|
@ -50,6 +50,7 @@
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
|
use std::collections::HashMap;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
@ -514,6 +515,9 @@ pub struct HtmlConfig {
|
||||||
/// This config item *should not be edited* by the end user.
|
/// This config item *should not be edited* by the end user.
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub livereload_url: Option<String>,
|
pub livereload_url: Option<String>,
|
||||||
|
/// The mapping from old pages to new pages/URLs to use when generating
|
||||||
|
/// redirects.
|
||||||
|
pub redirect: HashMap<PathBuf, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HtmlConfig {
|
impl Default for HtmlConfig {
|
||||||
|
@ -693,6 +697,10 @@ mod tests {
|
||||||
editable = true
|
editable = true
|
||||||
editor = "ace"
|
editor = "ace"
|
||||||
|
|
||||||
|
[output.html.redirect]
|
||||||
|
"index.html" = "overview.html"
|
||||||
|
"nexted/page.md" = "https://rust-lang.org/"
|
||||||
|
|
||||||
[preprocessor.first]
|
[preprocessor.first]
|
||||||
|
|
||||||
[preprocessor.second]
|
[preprocessor.second]
|
||||||
|
@ -731,6 +739,15 @@ mod tests {
|
||||||
playpen: playpen_should_be,
|
playpen: playpen_should_be,
|
||||||
git_repository_url: Some(String::from("https://foo.com/")),
|
git_repository_url: Some(String::from("https://foo.com/")),
|
||||||
git_repository_icon: Some(String::from("fa-code-fork")),
|
git_repository_icon: Some(String::from("fa-code-fork")),
|
||||||
|
redirect: vec![
|
||||||
|
(PathBuf::from("index.html"), String::from("overview.html")),
|
||||||
|
(
|
||||||
|
PathBuf::from("nexted/page.md"),
|
||||||
|
String::from("https://rust-lang.org/"),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
.into_iter()
|
||||||
|
.collect(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue