0

I have an octopress blog. I have content what I want only to show if I'm on the post page.

Is there some possibility like {% if post.page %}

Azd325
  • 5,752
  • 5
  • 34
  • 57

1 Answers1

2

Since your question is not entirely clear, I am assuming that you have a bunch of posts that you want to display on the post page and not on the index page. Here, I think you can display the titles of the posts on your landing page, so that when the user clicks on a particular link/post they can read the post in it's entirety in it's post page. To do that, you can modify your index.html thus :

---
layout: page
footer: false
sidebar: true
---

<div id="blog-archives">
{% for post in site.posts reverse %}
{% capture this_year %}{{ post.date | date: "%Y" }}{% endcapture %}
{% unless year == this_year %}
  {% assign year = this_year %}
  <h2>{{ year }}</h2>
{% endunless %}
<article>
  {% include archive_post.html %}
</article>
{% endfor %}
</div>
<aside class="sidebar">
  {% if site.blog_index_asides.size %}
    {% include_array blog_index_asides %}
  {% else %}
    {% include_array default_asides %}
  {% endif %}
</aside>
shaktimaan
  • 11,962
  • 2
  • 29
  • 33
  • Just a note to say that the correct Liquid syntax for a reversing the elements when iterating using a for loop is to specify `reversed`, not `reverse` (http://shopify.github.io/liquid/tags/iteration/#reversed) – Mark Crossfield Jan 08 '17 at 13:46