Skip to content
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

Problem with Indexes #12

Open
taringamberini opened this issue Apr 26, 2015 · 8 comments · May be fixed by #13
Open

Problem with Indexes #12

taringamberini opened this issue Apr 26, 2015 · 8 comments · May be fixed by #13

Comments

@taringamberini
Copy link

Setting Octopress

I've installed and configured Octopress as described at:

Installing octopress-multilingual

Then I've installed:

group :jekyll_plugins do
  gem 'octopress-multilingual'
end

and I've run:

$ bundle

Setting octopress-multilingual

Finally I've been following the Indexes section but there are unexpected behaviours:

  • at http://localhost:4000/index.html
    • there are all posts in all languages in content area (that's right)
    • there are all posts in all languages in recent post aside area (that's right)
  • at http://localhost:4000/index-it.html
    • there are not any posts in content area (that's wrong)
    • there are all it posts in recent post aside area (that's right)
  • at http://localhost:4000/en/index.html
    • there are not any posts in content area (that's wrong)
    • there are all en posts in recent post aside area (that's right)

Thanks,
Tarin

@taringamberini
Copy link
Author

Struggling to find a solution I finally bumped into octopress-paginate plugin where I've surprisingly found the section Multilingual pagination.

So I've installed it and added the following:

paginate: true

to the yaml front of index-it.html as in the following:

---
layout: default
paginate: true
lang: it
---

<div class="blog-index">

  {% assign index = true %}
  {% for post in paginator.posts %}
  ...

and to the yaml front of en/index.html as in the following:

---
layout: default
paginate: true
lang: en
---

<div class="blog-index">
  {% assign index = true %}
  {% for post in paginator.posts %}
  ...

so, finally, the indexes are as expected:

  • at http://localhost:4000/index-it.html
    • there are all it posts in content area (that's right)
    • there are all it posts in recent post aside area (that's right)
  • at http://localhost:4000/en/index.html
    • there are all en posts in content area (that's right)
    • there are all en posts in recent post aside area (that's right)

Please consider adding a cross-link to Multilingual pagination in the Indexes, RSS feeds and Archives section because it was very annoying and frustrating following octopress-multilingual without having almost anything works as described (I was really very close to give it up).

taringamberini added a commit to taringamberini/multilingual that referenced this issue Apr 26, 2015
PROBLEM

The instructions given for the index page doesn't work after Octopress Initial Installation.

CAUSE

Configuring Octopress as described at [Initial setup](http://octopress.org/docs/setup/) leads to an index page which loops over a `paginator` and not over a `site`.

SOLUTION

I've added the section `Keeping index installed from Octopress Initial Setup` to explain ho to make the `paginator` multilingual-aware.

octopress#12
@taringamberini taringamberini linked a pull request Apr 26, 2015 that will close this issue
@uaqben
Copy link

uaqben commented Jul 28, 2015

Hi Tarin

I've just installed a new octopress today, using octopress-multilingual.

I added lang: en to the default index.html, and then duplicated it as es/index.html, setting this one to lang: es.

The posts, which are also properly tagged, appear on their respective index page. (though I would prefer that the default root index file, which is flagged as en, also be made available when visiting site.com/en/; currently it does not, which is not cool, I find).

On the other hand, I have not been able to get my Pages flagged as en and es to properly show on their respective index.html. I have two "About" pages, and both always appear... :(

I looked at the _includes/header.html, tried to add/set {{ page.lang }}, such as:

<a class="page-link" href="{{ page.url | prepend: site.baseurl | page.lang }}">{{ page.title }}</a>

Didn't do anything.

I set also a translation id to those "About pages" and still they both appear the navigation/header.

Do you have any ideas/suggestions..? Or should I submit an Issue?

@taringamberini
Copy link
Author

Hi Tarin

Hi Ben,

I've just installed a new octopress today, using octopress-multilingual.

I added lang: en to the default index.html, and then duplicated it as es/index.html, setting this one to lang: es.

The posts, which are also properly tagged, appear on their respective index page. (though I would prefer that the default root index file, which is flagged as en, also be made available when visiting site.com/en/; currently it does not, which is not cool, I find).

You may do that as documented at Landing Page vs. Blog Index

On the other hand, I have not been able to get my Pages flagged as en and es to properly show on their respective index.html. I have two "About" pages, and both always appear... :(

I looked at the _includes/header.html, tried to add/set {{ page.lang }}, such as:

{{ page.title }}

Didn't do anything.

I'm quite new to blogging, and I don't feel comfortable with the difference
between posts and pages, but I'm getting used to it. In fact the index.html
contains {% for post in paginator.posts %}. As far as I've understand blog
index gather only posts, and not pages, in reversed chronological order. These
links might help you as helped me:

I set also a translation id to those "About pages" and still they both appear the navigation/header.

Do you have any ideas/suggestions..? Or should I submit an Issue?

I've just deployed my octopress multilingual site at https://taringamberini.github.io and you can find my octopress site sources on the source branch at https://github.com/taringamberini/taringamberini.github.io/tree/source so you can see:

  • what I configured: looking to source code
  • why I configured it: looking to commits' message (I'm a fan of commit messages ).

If you have any questions I'll be happy to help you,
Tarin

@uaqben
Copy link

uaqben commented Jul 31, 2015

Thanks Tarin

I've had a look at your source.

I have tried a similar approach to yours - using what you did here, but it's not working for me...

{% if page.lang == 'en' %}
   {% set_lang en %}
     {% for page in site.pages %}
       {% if page.title %}
         <li class="page-scroll">
             <a href="{{ lang }}{{ site.baseurl }}{{ page.url }}">{{ page.title }}</a>
         </li>
       {% endif %}
     {%endfor%}
   {% endset_lang %}
 {% else if page.lang == 'es' %}
   {% set_lang es %}
     {% for page in site.pages %}
        {% if page.title %}
          <li class="page-scroll">
              <a href="{{ lang }}{{ site.baseurl }}{{ page.url }}">{{ page.title }}</a>
          </li>
        {% endif %}
      {%endfor%}
   {% endset_lang %}
  {% endif %}

I get the following error upon compiling:

Liquid Exception: can't clone NilClass in _includes/nav.html, included in _layouts/default.html
jekyll 2.5.3 | Error:  can't clone NilClass

@taringamberini
Copy link
Author

You have got the following error:

I get the following error upon compiling:

Liquid Exception: can't clone NilClass in _includes/nav.html, included in _layouts/default.html
jekyll 2.5.3 | Error: can't clone NilClass

Does the error might be caused by the {{ lang }} that should be {{ page.lang }}?

In order to exclude problems with your ruby and gems installations would you like to generate my site?

$ git clone https://github.com/taringamberini/taringamberini.github.io.git
$ cd taringamberini.github.io/
$ git checkout source
$ rake generate (or to get more info: jekyll build --trace)
$ rake preview

Let me know,
Tarin

@uaqben
Copy link

uaqben commented Aug 1, 2015

Installing RedCloth 4.2.9 with native extensions
Installing chunky_png 1.3.4
Installing compass-core 1.0.3
Installing compass-import-once 1.0.5
Installing compass 1.0.3
Installing tilt 2.0.1
Installing haml 4.0.6
Installing jekyll-sitemap 0.8.1
Installing octopress-date-format 2.0.2
Installing octopress-feeds 2.0.4
Installing rack-protection 1.5.3
Installing rdiscount 2.1.8 with native extensions
Installing sass-globbing 1.0.0
Installing sinatra 1.4.6
Installing stringex 1.4.0

Once installed jekyll generated your site fine.

However, on my site, I still have same NilClass error from Jekyll/Liquid when using the {% if page.lang == 'en' %} or {% set_lang en %} operators...

@taringamberini
Copy link
Author

However, on my site, I still have same NilClass error from Jekyll/Liquid when using the {% if page.lang == 'en' %} or {% set_lang en %} operators...

I've tried your approach in my navigation.html but I wasn't able to reproduce your error.

I'll hope the best for your opened issue #19 .

Hi,
Tarin

@uaqben
Copy link

uaqben commented Aug 10, 2015

Thanks - I found a solution which works for me, in case you're interested, I submitted it here: #20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants