Redirected Octopress blog on Github pages shows only Archives link instead of the latest posts
Asked Answered
B

1

5

I have set up Octopress with my Github account at http://acgrama.github.io/. The main page is a vanilla HTML, non-Octopress landing page, and the blog is set up in Octopress under source/blog. (I have followed the instructions in the "Landing Page vs. Blog Index" section of http://octopress.org/docs/theme/template/)

Everything is ok, except when I go to http://acgrama.github.io/blog/ I see a link to the blog archives instead of the latest blog posts.

Some symptoms that I noticed: when I do rake generate, I get the following output:

## Generating Site with Jekyll
identical source/stylesheets/screen.css
Configuration file: /home/***/octopress/_config.yml
            Source: source
       Destination: public
      Generating...
        Pagination: Pagination is enabled, but I couldn't find an index.html page to use as the pagination template. Skipping pagination.
                    done.

Looking under source/blog/index.html, I understand that the posts in paginator.posts are iterated and shown (?), after which the Older/Newer and Blog Archives links are shown:

<div class="blog-index">
  {% assign index = true %}
  {% for post in paginator.posts %}
  {% assign content = post.content %}
    <article>
      {% include article.html %}
    </article>
  {% endfor %}
  <div class="pagination">
    {% if paginator.next_page %}
      <a class="prev" href="{{paginator.next_page_path}}">&larr; Older</a>
    {% endif %}
    <a href="/blog/archives">Blog Archives</a>
    {% if paginator.previous_page %}
    <a class="next" href="{{paginator.previous_page_path}}">Newer &rarr;</a>
    {% endif %}
  </div>
</div>

These made me think that paginator.posts is empty for some reason, hence nothing happens in the first for loop and this is how only the Blog Archive link ends up being shown.

Am I doing anything wrong? Can this issue be solved at all?

Brittaneybrittani answered 23/6, 2014 at 9:55 Comment(0)
N
15

I had the exact same issue and I found an answer based on your suspicion that paginator.posts was empty.

Update _config.yml and set the following:

paginate_path: "posts/:num"

to

paginate_path: "blog/posts/:num"

After that and a rake generate and rake preview, the /blog page showed my posts

This would lead me to believe that the paginator must be made aware of the subdirectory change for /blog. Really seems like something that should be in the docs

Nildanile answered 29/6, 2014 at 5:55 Comment(3)
Thanks a lot, this sounds quite plausible! I will try it out.Brittaneybrittani
It works indeed -- in hindsight, I don't know how I missed this :-) Thanks again.Brittaneybrittani
Worked for me also, similarly after setting up a landing page.Mugwump

© 2022 - 2024 — McMap. All rights reserved.