Skip to content

Commit

Permalink
Fix some feed_filenames issues with multi languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Keats committed Aug 15, 2024
1 parent 56122de commit f8ded09
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 0.20.0 (unreleased)

- Fix some of YAML date parsing
- Fix feed generation for languages not working in some cases (it was taking the value from the root of the config for
feed_filenames)

## 0.19.1 (2024-06-24)

- Fix `config.generate_feeds` being still serialized as `config.generate_feed`. Both are available for now
Expand Down
4 changes: 1 addition & 3 deletions components/site/src/feeds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn render_feeds(
context.insert("lang", lang);

let mut feeds = Vec::new();
for feed_filename in &site.config.feed_filenames {
for feed_filename in &site.config.languages[lang].feed_filenames {
let mut context = context.clone();

let feed_url = if let Some(base) = base_path {
Expand All @@ -85,9 +85,7 @@ pub fn render_feeds(
};

context.insert("feed_url", &feed_url);

context = additional_context_fn(context);

feeds.push(render_template(feed_filename, &site.tera, context, &site.config.theme)?);
}

Expand Down
2 changes: 1 addition & 1 deletion components/site/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ impl Site {
None => return Ok(()),
};

for (feed, feed_filename) in feeds.into_iter().zip(self.config.feed_filenames.iter()) {
for (feed, feed_filename) in feeds.into_iter().zip(self.config.languages[lang].feed_filenames.iter()) {
if let Some(base) = base_path {
let mut components = Vec::new();
for component in base.components() {
Expand Down

0 comments on commit f8ded09

Please sign in to comment.