# Directory Listing plugin help

**URL:** <https://talk.jekyllrb.com/t/directory-listing-plugin-help/5513>\
**Category:** Help\
**Created:** [January 15, 2021, 3:02pm UTC](https://talk.jekyllrb.com/t/directory-listing-plugin-help/5513 "2021-01-15T15:02:22Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [January 15, 2021, 8:45pm UTC](https://talk.jekyllrb.com/t/directory-listing-plugin-help/5513/4 "2021-01-15T20:45:00Z")

</div>

Would you consider using a Jekyll solution using Liquid templating instead of Ruby code? This is also a _lot_ less code.

My solution lists pages at the exact same directory as the current page. Where the page that uses this `includes` bit is index.md

```auto
{% assign pages = site.pages | sort: 'title' %}

<ul>
    {% for item in pages %}
        {% if item.dir == page.dir and item.path != page.path %}
           <li> {{ item.name }} </li>
        {% endif %}
   {% endfor %}
</ul>

```

Then in a folder one level down, there is another index.md file which lists the page in it’s own directory.

I do a listing of pages as above as a bullet list and then I also have a menu of buttons for directories at the current directory. Which really means that for `index.md`, if there is `foo/index.md` and `bar/index.md` then there are links to `/foo/` and `/bar/`

If you prefer you could update my snippet to list pages at the current level and all nested levels below. By changing `item.dir == page.dir` (which uses the current pages directory) you can use a starts with condition or `contains` condition. Or you split the path string by `/` so you can array of breadcrumbs and then you check the first few are equal.

Here is my snippet in context of a fork of minima. I used it for nested menus on a few sites.

> <https://github.com/MichaelCurrin/minima/blob/master/_includes/structure/page-list.html>

Here is an example page [Jekyll | Dev Cheatsheets](https://michaelcurrin.github.io/dev-cheatsheets/cheatsheets/jekyll/)

---

_[View the full topic](https://talk.jekyllrb.com/t/directory-listing-plugin-help/5513)._
