Closed hansspiess closed 8 years ago
having the same issue here. I've tried moving it around to different places and adding the info to the language.yml file under pages, but no go.
Ah. Figured it out. You must create a normal page at the root (in this case an about page) with the header and with this in the content:
---
layout: page
title: About
permalink: /about/
---
{% translate_file about/about.md %}
Then inside each of the language folders you just have markdown with the correct language. Make sure to erase the headers from those md files, or else your site will break.
Hi @elotroalex, can you please add your explanation to the README and create a PR, thanks!
Put it on the to do pile. I'll try to get to it soon.
:D
OK, I was looking for a way to translate pages and it is good. But Is there a way to translate page title too?
@UnclePetros The best way is probably to use the default lang file :
in en.yml
global:
title: My default website title!
pages:
about:
title: Get to know me
contact
title: Contact me
Then, in about.html
---
layout: default
permalink: /about/
title: pages.about.title
---
Well, hello there!
And in your _layouts/default.html
<head>
<title>{% if page.title contains "pages." %}{% t page.title %}{% else %}{% t global.title %}</title>
...
HI Jason, thank you for the answer. This works fine for title. But what about the permalink?
I've tried to do a short test with the following:
---
layout: page
title: pages.about
permalink: /{% translate pages.about %}/
---
{% translate_file about/about.md %}
But it fails. Is there a chance to translate permalink?
@UnclePetros yes, that was part of my last pull request (I will need to add some documentation about that in the README ..)
Have a look at #53 for more infos, and let me know if you have problems using it!
Yes, sorry Jason, I was just reading your fix on permalinks. Unfortunately I don't manage in installing plugin ver. 1.3.0. I place files in my project _plugins directory but when I compile I receive the following error
undefined method `include?' for nil:NilClass
Any idea?
Might be one of your file that is missing the "permalink" in its header. My plugin isn't bullet proof, there's so much to double check, and Jekyll isn't throwing detailed error messages, even with --trace ... So, you will probably need to start with a copy of your project with almost nothing in it, then add pieces by pieces, pages by pages, until it crash. Then, you will know where the error is coming from. Please let me know when you fix it.
OK, thank you very much for you availability. I've done some tests with both Octopress (my platform) and Jekyll. I've tried with a fresh octopress installation (on top of jekyll 2.5.3) and it gives always the same error:
undefined method `include?' for nil:NilClass
So I've downloaded Jekyll latest version, installed the plugin, and try to build. It returns this error:
Error: undefined method
read_posts’ for class
Jekyll::Site'
That is: #52 I've also googled for the error and found this: https://talk.jekyllrb.com/t/error-undefined-method-read-posts-for-class-jekyll-site/1392/2
Update: Ok, It seems Anthony Gaudino has solved the issue against the latest jekyll version. I'll try and let you know.
OK, Anthony new version of the plugin works like a charm. I've installed it against Ruby 2.0.0 and my Octopress fork.
Thank you very much.
Let me know if you need further info.
Regards UnclePetros
Version 1.4.0 README.md has a section explaining this.
i've been trying to add pages to the example instance following the given structure:
/_i18n/de/about/about.md
seems like i got it wrong.. any hints?