Skip to content

How can I display all tags? #444

Discussion options

You must be logged in to vote

With the latest API you can group/divide a page collection into multiple smaller collections.

Example 1 - Layout file to show tags with ascending name, A-Z:

<?php $this->yellow->layout("header") ?>
<div class="content">
<div class="main" role="main">
<h1><?php echo $this->yellow->page->getHtml("titleContent") ?></h1>
<?php echo $this->yellow->page->getContentHtml() ?>
<?php $pages = $this->yellow->content->index()->filter("layout", "blog")->sort("published", false) ?>
<?php $this->yellow->page->setLastModified($pages->getModified()) ?>
<ul>
<?php foreach ($pages->group("tag") as $tag=>$collection): ?>
<li><?php echo htmlspecialchars($tag)." (".count($collection).")" ?></li>
<?php endforeach 

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@pftnhr
Comment options

Answer selected by annaesvensson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #444 on December 27, 2020 13:42.