-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option localizable
to separate blog articles per locale
#355
base: master
Are you sure you want to change the base?
Conversation
Marking feature as @wip since it's not working yet
So that overview pages don't list articles from other languages
Following the configuration of middleman-i18n, blog articles are now prefixes with the proper locale. Articles in the default locale, when mount_at_root is used, remain unprefixed. This way we're mimicking the schema used for pages in the localizable folder in middleman-i18n enabled apps.
So that they don't list articles from other languages. Also prefixing the paths according to middleman-i18n configuration with proper locale prefix.
1 similar comment
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: <%= link_to tag.capitalize, tag_path(tag) %>For every other language, it just displays "#" in the link's href. |
Since it was failing randomly with the server, but working properly when run in isolation.
@passatgt Thanks for taking a look at the proposed changes. I have just updated the PR to fix Could you give me an example of how you wanted to use the |
@schmidt so this is my setup:
Expected to generate /support/category/something/index.html, however this is not generated at all. Using the config like this, works as expected:
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.