Skip to content

The docs need more variety and specificity in function examples #7

@EzequielBruni

Description

@EzequielBruni

The problem I've run into when trying to develop themes for Typemill is that I am very much not a programmer. Showing me how a Twig function or loop works with a single example isn't really enough for those of us who have a good handle on HTML/CSS and the like, but have trouble understanding anything more complicated than an if/else statement.

Take this example from the docs:

{% set pagelist = getPageList(navigation, settings.themes.emergency.listpages, base_url) %}
  <ol class="postlist" reversed>
    {% for element in pagelist.folderContent %}
      {% set post = getPageMeta(settings, element) %}
      {% set date = element.order[0:4] ~ '-' ~ element.order[4:2] ~ '-' ~ element.order[6:2] %}
      <li>
         <a href="{{ element.urlAbs }}">{{ post.meta.title }}</a> <time datetime="{{date}}">({{ date | date("d.m.Y") }})</time>
      </li>

    {% endfor %}
  </ol>

That tells me how to make it so I can set a folder in getPageList based on theme settings, and use it to display a folder's contents. But how would I set the folder manually, in the code itself? Is there some sort of page ID that needs to go where settings.themes.emergency.listpages is? How would I use this code to loop through all of my top-level folders to display their contents in a directory-style page?

Failing that, how would I add more details about each page or item to the navigation function, such as the meta description?

Simply put, we need more examples in the documentation, and I'm not smart enough to write them myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions