Open pmk1c opened 6 years ago
Hello,
thank you for this post.
It is just what I'm looking for.
However I'm relatively new to ruby, so I need a little help in order to install your extension.
Here what I've done:
I've executed command middleman extension blog_prepend_i18n_path
Then I've replaced file in lib directory with your own file (that is blog_prepend_i18n_path.rb).
Then I've added values in blog_prepend_i18n_path.gemspec files and I've executed bundle install
.
All went fine.
But extension seems not to be installed in my system, so middleman give an error when building.
Is there anything I forgot?
Thank you.
Regards Pietro
You don't need to run middleman extensions blog_prepend_i18n_path
. All you have to do is to copy our extension to i.e. your lib
folder. Then you can require it in your config.rb
file:
# config.rb
require 'lib/blog_prepend_i18n_path'
activate :blog do |config|
config.blog_name = 'blog'
…
end
activate :blog_prepend_i18n_path do |config|
config.blog_name = 'blog'
end
We won't be publishing this hack as a gem. Since we'd rather have middleman-blog
handle this in a less hacky way.
ℹ️ 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.
It would be great if Middleman Blog could handle the
mount_at_root
option given by the:i18n
extension. For example by providing an option to prepend the i18n path root to the articles permalinks.In one of our projects we have a configuration like this:
With this configuration all german ("de") pages are mounted at root, but the german blog posts are found under
/de/blog/…
So for reaching our goal, that the blog posts can be found under
/blog/…
while the english blog posts remain at/en/blog/…
, we use the following configuration and prepend the i18n path root within our own extension:This is the extensions code: https://gist.github.com/pmk1c/f192dd30edba2a25c9f352d1e8df8234
So one way for Middleman Blog to fully support
:i18n
could be to add a configuration option, that prepends the i18n path root to the permalinks of the articles. Leading to a configuration like this:But maybe there are better options to support
mount_at_root
. I'm open for discussion and I'd like to send a PR for this, if we find a solution.