Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can't add your own collection to <code>site</code> just like that.</p> <p><code>site</code> only knows about three collections: <code>pages</code>, <code>posts</code>, and <code>categories</code>. You can get all the posts of a category by doing <code>site.&lt;category&gt;.posts</code> . AFAIK, categories only work for posts, not pages.</p> <p>This makes sense, since Jekyll is supposed to be mainly a blogging engine, and not a generic static website generator.</p> <p>So your best solution right now consists on "lying" to jekyll. Make it believe you have posts, when in reality you are making pages.</p> <pre><code>_posts/ pressitems/ blog/ </code></pre> <p>You will be able to loop over the elements inside _posts/pressitems like this:</p> <pre><code>for item in site.categories.pressitems.posts do ... {{ item.title }} ... {{ item.url }} endfor </code></pre> <p>Similarly, your "real blog entries" would go this way:</p> <pre><code>for p in site.categories.blog.posts do ... {{ p.title }} ... {{ p.url }} endfor </code></pre> <p>The catch is that you will have to respect Jekyll's naming convention regarding filenames; your pressitems have to look like real posts. This means they have to be named starting with a yyyy-mm-dd- string, like posts. Just give them a random date.</p> <pre><code>_posts/ pressitems/ 1901-01-01-the-first-press-item.textile 1902-01-01-the-second-one.textile </code></pre> <p>EDIT: This was true when this post was originally written, in 2012, but not any more. Modern Jekyll does allow you to create your own collections <a href="https://jekyllrb.com/docs/collections/" rel="nofollow noreferrer">https://jekyllrb.com/docs/collections/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload