Open schmidt opened 6 years ago
I had some issues with this branch using the blog.prefix parameter. The tags are not generated this way. Specifying the prefix manually in the blog.permalink and blog.taglink does work.
Also, trying to link to a tag archive only works on the main langue:
For every other language, it just displays "#" in the link's href.
@passatgt Thanks for taking a look at the proposed changes.
I have just updated the PR to fix tag_path
and the corresponding calendar path helpers. This was basically an oversight on my end. Thanks for the pointer.
Could you give me an example of how you wanted to use the blog.prefix
option? Then I'll try to take a closer look.
@schmidt so this is my setup:
activate :blog do |blog|
blog.localizable = true
blog.prefix = "support"
blog.permalink = "{title}.html"
blog.sources = "{lang}/{year}-{month}-{day}-{title}.html"
blog.taglink = "category/{tag}.html"
blog.tag_template= 'support-category.html'
blog.layout = "support-article"
end
Expected to generate /support/category/something/index.html, however this is not generated at all.
Using the config like this, works as expected:
activate :blog do |blog|
blog.localizable = true
#blog.prefix = "support"
blog.permalink = "support/{title}.html"
blog.sources = "support/{lang}/{year}-{month}-{day}-{title}.html"
blog.taglink = "support/category/{tag}.html"
blog.tag_template= 'support/support-category.html'
blog.layout = "support-article"
end
Thanks for the tag_path update, i'll check it out.
Update: the tag_path update is working 👍
ℹ️ 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.
middleman-blog
already supportsmiddleman-i18n
, so that blog articles can have locales assigned. This locale can be used in the path. And it is used in the article and layout.But we were trying to separate the articles in different languages completely, similar to the way the
localizable
folder inmiddleman-i18n
works. With the following configuration:we were hoping for the following result:
Furthermore, we wanted to have
build/blog.html
only list English articles, whilebuild/fr/blog.html
should list French articles only (and the same tag pages).Unfortunately, this cannot be achieved using the current features and configuration options of
middleman-blog
. There are some discussions within this bug tracker and on the internet, which suggest, using separate blog instances for each language, but then we need to duplicate the calendar and tag templates, because each of these can only belong to a single blog instance.So I went ahead and extended
middleman-blog
accordingly. Since the separation of blog articles by locale is a change in behaviour, I decided to activate this feature only when a newly introduced configuration option is set. Since I was aiming at the same path structure, as the one that's generated bymiddleman-i18n
and thelocalizable
folder, I've usedblog.localizable = true
. Another possible name would have beenblog.separate_locales = true
.Please let me know, if you're interested in this feature and if I can do anything to help you review or merge these changes.