middleman / middleman-blog

Blog Engine Extension for Middleman
https://middlemanapp.com
MIT License
326 stars 179 forks source link

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

Open andreamoro opened 6 years ago

andreamoro commented 6 years ago

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.

_blogtag.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

andreamoro commented 6 years ago

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

mrtndwrd commented 6 years ago

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?

andreamoro commented 6 years ago

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 commented 6 years ago

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

andreamoro commented 5 years ago

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

tdreyno commented 5 years ago

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

I'll take a look

markets commented 7 months ago

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