How can i select current "tags"?

Hi I want to make…
Screen Shot 2022-10-16 at 11.54.45 AM
when I go to …/works/tag:architerior, i want to make showing current tags as a text.
so I use “<?= $page->tags() ?>” but nothing appear.
also I want to edit this …

<?php if ($works = page('works')): ?>
            <?php foreach ($works->children()->listed() as $item): ?>
                <a href="<?= $item->url() ?>"><?= $item->title() ?></a><br>
            <?php endforeach ?>
        <?php endif ?>

to connect with current tags only…

How can i place the name…?
thank you very much…

<?= param('tag') ?>

Will show the current tag from the URL, if that’s what you mean.

$items = $works->children()->listed();
if ($tag = param('tag') {
    $items = $items->filterBy('tags', $tag, ','); // assuming your field is called `tags`, modify as needed
}
foreach ($items as $item) {
  // ...
}

Hi! thank you very much!! :sob::sob::sob:
should I mix my code and yours…? or should I write your code on the top…? or…
I am so sorry…

<?php snippet('header') ?>

<main class="wrapper-main">
    <div>
        TYPOLOGY<br>
        <?= param('tag') ?><br>

        <?php if ($works = page('works')): ?>
            <?php foreach ($articles->children()->listed() as $item): ?>
                <a href="<?= $item->url() ?>"><?= $item->title() ?></a><br>
            <?php endforeach ?>
        <?php endif ?>
    </div>
</main>
<?php snippet('footer') ?>

<?php snippet('header') ?>
<?php 
$tag = param('tag');
$works = page('works');
$items = null;
if ($works) {
  $items = $works->children()->listed();
if ($tag) {
    $items = $items->filterBy('tags', $tag, ',');
}
?>
<main class="wrapper-main">
   <?php if ($tag) : ?>
    <div>
        TYPOLOGY<br>
        <?= $tag ?><br>
    <?php endif; ?>
        <?php if ($items && $items->isNotEmpty()): ?>
            <?php foreach ($items as $item): ?>
                <a href="<?= $item->url() ?>"><?= $item->title() ?></a><br>
            <?php endforeach ?>
        <?php endif ?>
    </div>
</main>

I’d put the logic into a controller instead of having it in the template.

Example:

wow!!! It works!! super!! thank you very much!!
you are an angel… :innocent:

can I ask one more things?

I am making index page now… I want to load every tags. I already read this page:

but my page showing like this…
"
[Asan Xi Grand Park]
[Songdo Global Academic Complex]
[The Sharp the Arstie]
[The Sharp LePRIVE]
[Geomdan Xi]
listed
listed
listed
listed
listed

exterior
"
do you know why…?
this is my code:

<?php snippet('header') ?>

<main class="wrapper-content">
    <?php if ($seallist = page('works')): ?>
            <?php foreach ($seallist->children() as $item): ?>
                <a href="<?= $item->url() ?>"><?= $item->engtitle() ?></a><br>
            <?php endforeach ?><br>

            <?php foreach ($seallist->children()->sortBy('status', 'asc') as $item): ?>
                <a href="<?= $item->url() ?>"><?= $item->status() ?></a><br>
            <?php endforeach ?><br>

            <ul class="tags">
                <?php foreach($tags as $tag): ?>
                <li>
                <a href="<?= url($seallist->url(), ['params' => ['year' => $tag]]) ?>">
                    <?= html($tag) ?>
                </a>
                </li>
                <?php endforeach ?>
            </ul>
    <?php endif ?>
</main>

<?php snippet('footer') ?>

thank you very much again…!

This comes from your second foreach loop which echos the status of the page (listed, unlisted, draft). To be honest, I don’t know why you have this loop at all.

ahhh… I deleted second one!
I mean… I just want to load every tags(year,status,client,category…etc) as a list.
I have 5 types of tags…
but when I use this code:

<?php snippet('header') ?>

<main class="wrapper-content">
    <?php if ($seallist = page('works')): ?>
            <?php foreach ($seallist->children() as $item): ?>
                <a href="<?= $item->url() ?>"><?= $item->engtitle() ?></a><br>
            <?php endforeach ?><br>

            <ul class="tags">
                <?php foreach($tags as $tag): ?>
                <li>
                <a href="<?= url($seallist->url(), ['params' => ['tags' => $tag]]) ?>">
                    <?= html($tag) ?>
                </a>
                </li>
                <?php endforeach ?>
            </ul>
    <?php endif ?>
</main>

<?php snippet('footer') ?>

just showing “exterior”…