-
-
Notifications
You must be signed in to change notification settings - Fork 41
Enable hosting localized blogs under each locale namespace #83
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
Conversation
This doesn't change anything about the existing English blog.
|
||
# Localized blogs at /{lang}/blog | ||
activate :blog do |blog| | ||
blog.name = 'i18n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like an odd name. What is blog.name
used for by middleman?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When there're multiple blog instances in a single middleman site (i.e. when defined activate :blog
multiple times), we need to name each of them and specify the name in some helper methods (blog
, page_articles
). Otherwise an error will be raised:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not just direct /blog/*
to /blog/en/*
and do away with the two
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github pages doesn't allow you to return 3xx status codes for redirects. We could use meta redirects but that's gross.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Middleman allows us to proxy an entire set of pages, which I'd assume would duplicate the blog without processing it twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then we'll have the same content with two different canonical URLs to it. That's not a good idea. Among other things, it's a factor google takes into account for rankings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does that anyway, as it still takes en into account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I didn't realize that. Since we can't use proper HTTP redirects my preference is to keep the English blog available at it's current URLs and add /blog/ja
for Japenese blog posts but not /blog/en
as a mirror. Is that feasible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does that anyway, as it still takes en into account.
It doesn't generate /en
namespace because mount_at_root: :en
option is specified (for the /blog
index page) and the current_blog_name
helper returns the root blog name 'en'
for en
locale (for each permalink).
$ bundle exec middleman build
# ...
$ ls -l build
total 488
drwxr-xr-x+ 3 nkymyj staff 102 Nov 13 10:47 404/
drwxr-xr-x+ 3 nkymyj staff 102 Nov 13 10:47 about/
-rw-r--r--+ 1 nkymyj staff 8530 Nov 13 10:47 apple-touch-icon-114x114-precomposed.png
-rw-r--r--+ 1 nkymyj staff 3389 Nov 13 10:47 apple-touch-icon-120x120-precomposed.png
-rw-r--r--+ 1 nkymyj staff 12093 Nov 13 10:47 apple-touch-icon-144x144-precomposed.png
-rw-r--r--+ 1 nkymyj staff 13279 Nov 13 10:47 apple-touch-icon-152x152-precomposed.png
-rw-r--r--+ 1 nkymyj staff 3677 Nov 13 10:47 apple-touch-icon-57x57-precomposed.png
-rw-r--r--+ 1 nkymyj staff 3905 Nov 13 10:47 apple-touch-icon-60x60-precomposed.png
-rw-r--r--+ 1 nkymyj staff 4886 Nov 13 10:47 apple-touch-icon-72x72-precomposed.png
-rw-r--r--+ 1 nkymyj staff 5250 Nov 13 10:47 apple-touch-icon-76x76-precomposed.png
-rw-r--r--+ 1 nkymyj staff 3677 Nov 13 10:47 apple-touch-icon-precomposed.png
-rw-r--r--+ 1 nkymyj staff 3677 Nov 13 10:47 apple-touch-icon.png
drwxr-xr-x+ 9 nkymyj staff 306 Nov 13 10:47 blog/
drwxr-xr-x+ 3 nkymyj staff 102 Nov 13 10:47 contributing/
drwxr-xr-x+ 10 nkymyj staff 340 Nov 13 10:47 documentation/
-rw-r--r--+ 1 nkymyj staff 14071 Nov 13 10:47 favicon-160x160.png
-rw-r--r--+ 1 nkymyj staff 1198 Nov 13 10:47 favicon-16x16.png
-rw-r--r--+ 1 nkymyj staff 19660 Nov 13 10:47 favicon-196x196.png
-rw-r--r--+ 1 nkymyj staff 1828 Nov 13 10:47 favicon-32x32.png
-rw-r--r--+ 1 nkymyj staff 6959 Nov 13 10:47 favicon-96x96.png
-rw-r--r--+ 1 nkymyj staff 24838 Nov 13 10:47 favicon.ico
-rw-r--r--+ 1 nkymyj staff 1198 Nov 13 10:47 favicon.png
drwxr-xr-x+ 3 nkymyj staff 102 Nov 13 10:47 help/
drwxr-xr-x+ 30 nkymyj staff 1020 Nov 13 10:47 images/
-rw-r--r--+ 1 nkymyj staff 4462 Nov 13 10:47 index.html
drwxr-xr-x+ 3 nkymyj staff 102 Nov 13 10:47 ja/
drwxr-xr-x+ 4 nkymyj staff 136 Nov 13 10:47 javascripts/
-rw-r--r--+ 1 nkymyj staff 12093 Nov 13 10:47 mstile-144x144.png
-rw-r--r--+ 1 nkymyj staff 12874 Nov 13 10:47 mstile-150x150.png
-rw-r--r--+ 1 nkymyj staff 38957 Nov 13 10:47 mstile-310x310.png
-rw-r--r--+ 1 nkymyj staff 4678 Nov 13 10:47 mstile-70x70.png
drwxr-xr-x+ 6 nkymyj staff 204 Nov 13 10:47 stylesheets/
drwxr-xr-x+ 3 nkymyj staff 102 Nov 13 10:47 upgrading-from-rspec-2/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. I vote we go with this then :).
Looks good in general! |
Enable hosting localized blogs under each locale namespace
This doesn't change anything about the existing English blog.