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

4.0.2 regression bug when specifying the blog in the front-matter

Open andreamoro opened this issue 5 years ago • 7 comments

Expected behaviour

With multiple blogs declared in the configuration file and the i18n setup to support multiple languages, once declared a specific blog instance in the front-matter of a local variant, the page_articles collection should return the the list of articles beloning to that particular blog.

Actual behaviour

Starting from version 4.0.2 this behaviour is somehow compromised and using the second language file to access blog content returns an empty collection.

Steps to reproduce the problem

The i18N settings in the config.rb activate :i18n, :mount_at_root => false, :templates_dir => "content", :locales => [:en, :it]

The blog setup. The one below is for the English site. The Italian language is exactly the same, with the excetption of the output path, page_link, and tag_template .

activate :blog do |blogen|
  blogen.name = "blogen";
  blogen.prefix = 'en/blog'
  blogen.permalink = "{category}/:permalink"
  blogen.layout = "Blog-inner"
  blogen.preserve_locale = true

  blogen.summary_separator = /(READMORE)/
  blogen.summary_length = 350
  blogen.generate_day_pages = false
  blogen.generate_month_pages = false
  blogen.generate_year_pages = false
  blogen.paginate = true
  blogen.per_page = 3
  blogen.page_link = "page-{num}"

  blogen.taglink = "/{tag}/index.html"
  blogen.tag_template = "content/blog_tag.en.html"
end

FIle structure in my content directory looks like this 2018-08-04-xxxxxx.it.html.markdown.erb 2018-08-04-xxxxxx.en.html.markdown.erb

Note: the above configuration, with 4.0.2 and a specific "tag" works fine. And the strange thing is that front matters are pretty much similar, nothing that will impact on the way how the blog works.

blog_tag.en.html.erb front matter and content the it version is exactly the same, with the difference of the blog being blogit

---
layout: Blog
cssLayout: blog
blog: blogen
pageable: true
sitemap: false
---
<%
	# Get the category name from the first item in the array
	@category = page_articles[0].data.tags
%>
<%= partial("partials/blog-core") %>

blog.en.html.erb front matter and content the it version is exactly the same, with the difference of the blog being blogit

---
layout: Blog
cssLayout: blog
author: myname
blog: blogen
pageable: true
title: blogPageDefaultHeading
description: blogPageDefaultDescr
---
<%= partial("partials/blog-core") %>

As you can see the file used to render the content is exactly the same. If you wonder about that @category variable, that is used just to print out a value for aesthetic purposes. In fact, as you may know, the selection of the tags happens internally based of the tag written in the front matter of each article.

Additional information

  • Ruby version: 2.5
  • Middleman version: 2.5.0p0
  • Middleman Blog version: 4.0.2
  • OS version: 10.13.6

andreamoro avatar Sep 14 '18 06:09 andreamoro

Ok, so apparently the problem lays down with the pagination module. But that's where I can arrive. No experience to get my hands into the middleman code to fix this.

Anybody that can look into it? @iwarner @mrtndwrd

andreamoro avatar Sep 14 '18 07:09 andreamoro

I have no experience with the pagination module either. Did you make an issue in the Middleman repo?

What about the workaround I proposed in this other issue? Would that help your purpose?

mrtndwrd avatar Sep 14 '18 08:09 mrtndwrd

Was looking into this this morning, after many months me being not able to touch a line for my site.

Not sure what the outcome will be, but I'm not fancy in moving my content. I've fear to break something else.

andreamoro avatar Sep 14 '18 10:09 andreamoro

Actually have not reported on the middleman gitbìhub. Not sure the pagination module has a specific git @maartenvg.

andreamoro avatar Sep 14 '18 10:09 andreamoro

@tdreyno is there any chance somebody can investigate on this. This is happening also on the 4.0.3 version.

andreamoro avatar Feb 09 '19 20:02 andreamoro

Thanks for pinging me @andreamoro, I don't subscribe to this repo since it's normally maintained by others.

I'll take a look

tdreyno avatar Feb 10 '19 00:02 tdreyno

ℹ️ 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