parent
f3cfca23a5
commit
ffe8a24333
|
@ -1,5 +1,9 @@
|
|||
# Changelog
|
||||
|
||||
## 0.0.7 (unreleased)
|
||||
|
||||
- Sort individual tag/category pages by date
|
||||
|
||||
## 0.0.6 (2017-05-24)
|
||||
|
||||
- Fix missing serialized data for sections
|
||||
|
|
|
@ -135,6 +135,10 @@ You can also paginate section, including the index by setting the `paginate_by`
|
|||
This represents the number of pages for each pager of the paginator.
|
||||
You will need to access pages through the `paginator` object. (TODO: document that).
|
||||
|
||||
### Taxonomies: tags and categories
|
||||
|
||||
Individual tag/category pages are only supported for pages having a date.
|
||||
|
||||
### Code highlighting themes
|
||||
Code highlighting can be turned on by setting `highlight_code = true` in `config.toml`.
|
||||
|
||||
|
@ -223,6 +227,7 @@ In case of shortcodes with a body, the body will be passed as the `body` variabl
|
|||
|
||||
|
||||
## Adding syntax highlighting languages and themes
|
||||
|
||||
### Adding a syntax
|
||||
Syntax highlighting depends on submodules so ensure you load them first:
|
||||
```bash
|
||||
|
|
|
@ -6,6 +6,7 @@ use tera::{Context, Tera};
|
|||
use config::Config;
|
||||
use errors::{Result, ResultExt};
|
||||
use content::Page;
|
||||
use content::sorting::{SortBy, sort_pages};
|
||||
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
|
@ -24,10 +25,12 @@ pub struct TaxonomyItem {
|
|||
|
||||
impl TaxonomyItem {
|
||||
pub fn new(name: &str, pages: Vec<Page>) -> TaxonomyItem {
|
||||
// We shouldn't have any pages without dates there
|
||||
let (sorted_pages, _) = sort_pages(pages, SortBy::Date);
|
||||
TaxonomyItem {
|
||||
name: name.to_string(),
|
||||
slug: slugify(name),
|
||||
pages,
|
||||
pages: sorted_pages,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +51,14 @@ impl Taxonomy {
|
|||
|
||||
// Find all the tags/categories first
|
||||
for page in all_pages {
|
||||
// Don't consider pages without pages for tags/categories as that's the only thing
|
||||
// we can sort pages with across sections
|
||||
// If anyone sees that comment and wonder wtf, please open an issue as I can't think of
|
||||
// usecases other than blog posts for built-in taxonomies
|
||||
if page.meta.date.is_none() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if let Some(ref category) = page.meta.category {
|
||||
categories
|
||||
.entry(category.to_string())
|
||||
|
@ -109,10 +120,6 @@ impl Taxonomy {
|
|||
let name = self.get_single_item_name();
|
||||
let mut context = Context::new();
|
||||
context.add("config", config);
|
||||
// TODO: how to sort categories and tag content?
|
||||
// Have a setting in config.toml or a _category.md and _tag.md
|
||||
// The latter is more in line with the rest of Gutenberg but order ordering
|
||||
// doesn't really work across sections.
|
||||
context.add(&name, item);
|
||||
context.add("current_url", &config.make_permalink(&format!("{}/{}", name, item.slug)));
|
||||
context.add("current_path", &format!("/{}/{}", name, item.slug));
|
||||
|
|
|
@ -380,6 +380,10 @@ impl Site {
|
|||
}
|
||||
|
||||
fn render_taxonomy(&self, taxonomy: &Taxonomy) -> Result<()> {
|
||||
if taxonomy.items.is_empty() {
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
ensure_directory_exists(&self.output_path)?;
|
||||
|
||||
let output_path = self.output_path.join(&taxonomy.get_list_name());
|
||||
|
|
|
@ -2,6 +2,5 @@ title = "My site"
|
|||
base_url = "https://replace-this-with-your-url.com"
|
||||
highlight_code = true
|
||||
|
||||
|
||||
[extra.author]
|
||||
name = "Vincent Prouillet"
|
||||
|
|
Loading…
Reference in a new issue