Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove string manipulation of paths #1941

Merged
merged 2 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions components/site/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,14 @@ impl Site {
/// Reads all .md files in the `content` directory and create pages/sections
/// out of them
pub fn load(&mut self) -> Result<()> {
let base_path = self.base_path.to_string_lossy().replace('\\', "/");

self.library = Arc::new(RwLock::new(Library::new(&self.config)));
let mut pages_insert_anchors = HashMap::new();

// not the most elegant loop, but this is necessary to use skip_current_dir
// which we can only decide to use after we've deserialised the section
// so it's kinda necessecary
let mut dir_walker =
WalkDir::new(format!("{}/{}", base_path, "content/")).follow_links(true).into_iter();
WalkDir::new(self.base_path.join("content")).follow_links(true).into_iter();
let mut allowed_index_filenames: Vec<_> = self
.config
.other_languages()
Expand Down
4 changes: 4 additions & 0 deletions docs/content/documentation/templates/pages-sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ relative_path: String;
lang: String;
// Information about all the available languages for that content, including the current page
translations: Array<TranslatedContent>;
// All the pages/sections linking this page: their permalink and a title if there is one
backlinks: Array<{permalink: String, title: String?}>;
```

## Section variables
Expand Down Expand Up @@ -100,6 +102,8 @@ relative_path: String;
lang: String;
// Information about all the available languages for that content
translations: Array<TranslatedContent>;
// All the pages/sections linking this page: their permalink and a title if there is one
backlinks: Array<{permalink: String, title: String?}>;
```

## Table of contents
Expand Down