Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 872
ACEG Avatar asked Jun 23 '14 09:06

ACEG


1 Answers

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

like image 90
Will Haley Avatar answered Sep 26 '22 20:09

Will Haley