middleman-blog icon indicating copy to clipboard operation
middleman-blog copied to clipboard

page_articles.each doesn't pick the I18n language from the file name anymore

Open andreamoro opened this issue 7 years ago • 5 comments

Expected behaviour

The same that was happening with v. 4.0.1 were everything was working fine. Two separate blog instances in the config,rb were pulling out the list of content with the page_articles.each do

Actual behaviour

A page_articles.each do returns content only for the first of the two blogs only.

Steps to reproduce the problem

Config.rb file as

activate :i18n, :mount_at_root => false, :templates_dir => "content", :locales => [:en, :it]

activate :blog do |blogen| blogen.name = "blogit"; blogen.prefix = 'en/blog' ... end

activate :blog do |blogit| blogit.name = "blogit"; blogit.prefix = 'it/blog' ... end

Create two files, one with .en and one with the .it extension within

Use the page_articles method to pull out the list of content.

  • Please provide a repository or some tests we can run through I will try to put together a repository ASAP.

Additional information

  • Ruby version:
  • Middleman version: 4.2
  • Middleman Blog version: 4.0.2
  • OS version:

andreamoro avatar Jun 15 '17 06:06 andreamoro

I dont believe much regarding this was updated in the latest version - please continue to use the older one in the meantime and I will investigate.

iwarner avatar Jun 15 '17 09:06 iwarner

Hi @iwarner not sure what to say. By the time I forced the 4.0.1 version everything gone back to work as normal. Does this version include the template stuff and the i18n we discussed last time and for which you setup that repo?

andreamoro avatar Jun 15 '17 11:06 andreamoro

You can see what changed in the commits:

https://github.com/middleman/middleman-blog/commit/a8dd9fe352b4d7962e0b0e48c5ff4556c73d246e

My understanding is that page articles always pulled the default blog, and would not pull from two blogs.

iwarner avatar Jun 15 '17 12:06 iwarner

Hi @iwarner this is the case until you don't specify the blog name in the frontmatter. By the time you have your file containing something like blog: blogname the right instance is pulled out and content rendered (so long you are on 4.0.1).

On 4.0.2 this suddenly got broken, but skimming the code I don't see anything strange that could have impacted this behaviour.

andreamoro avatar Jun 15 '17 12:06 andreamoro

ℹ️ This issue is stale because it has been open for more than 90 days with no activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

markets avatar Apr 15 '24 18:04 markets