-
-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I show folders or categories with Twig? #414
Comments
This is a task predestined for the page tree shipped with Pico 2.0. You can download the latest beta from https://github.com/picocms/Pico/releases (also see #401). Don't worry about Pico 2.0 being in beta, it's actually ready-to-release, we just haven't finished the docs/website updates yet. First create a ---
title: My category
category: true
template: category
--- Listing categories (your <ul>
{% for category in pages["index"].tree_node.children %}
{% if category.page and category.page.meta.category %}
<li><a href="{{ category.page.url }}">{{ category.page.title }}</a></li>
{% endif %}
{% endfor %}
</ul> Listing pages in a category (your {% if meta.category and current_page.tree_node.children %}
{% for child in current_page.tree_node.children %}
{% if child.page and not child.page.hidden %}
<div>
<h3><a href="{{ child.page.url }}">{{ child.page.title }}</a></h3>
<p>{{ child.page.description }}</p>
</div>
{% endif %}
{% endfor %}
{% endif %} #edit: Splitting templates. |
Thank you, I'll download the 2.0 version and tell you if it worked. |
It worked! Now I have another question. I want to put a PHP include inside a .md file. but it seems to output in plain text. Is there any way to scape the markdown interpreter for a few lines or any other way to do something similar? |
This is not possible (on purpose). Use a Twig template instead (e.g. add |
Well, if someone has the same problem, I'm doing it throug jquery: `<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script> $(function(){ $("#tabla-webs").load("path/tabla-webs.html"); }); </script> `
|
@PhrozenByte what if I change the documents format from .md to .html in the config file? Will that allow me to use php include? |
No |
:( |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! 👍 |
Hi all. I'm looking for a way to show in the index page the folders inside /content.
Basically I'm trying to recreate a SILO structure in my site, so the index page shows the categories of the site and a list of links where template: page. When the user clicks that categories another page shows listing all the documents inside such category.
I've looked in the picocms docs but I didn't find anything suitable, and reading twig documentation I'm a bit lost to be honest.
The text was updated successfully, but these errors were encountered: