Current tag's url

Hi,
I want to display two categories in the nav, so I created a category tag and used the code below.
The problem is that I have 5 tags other than category. If I use the code below, all urls display all content.
https://groupseal.site/works/workstatus:Design%20in%20progress
https://groupseal.site/works/year:2018

<?php 
    $tag = param('tag');
    $works = page('works');
    $items = null;
    if ($works) {
    $items = $works->children()->listed();}
    if ($tag) {
        $items = $items->filterBy('category', $tag, ',');
    }
?>
<main class="wrapper-main">
   <div class="terior-title">
    <?php if ($works = page('works')): ?>
        <?php if ($tag): ?>
            <h3>TYPOLOGY</h3>
            <h1><?= $tag ?></h1><br>
        <?php endif ?>
    </div>

    <div class="terior-content">
        <?php if ($items && $items->isNotEmpty()): ?>
            <?php foreach ($items->paginate(7) as $item): ?>
                <div class="terior-item">
                    <div class="terior-item-left">
                        <a href="<?= $item->url() ?>"><?= $item->title() ?></a><br>
                        <?= $item->year() ?><br><br>
                        Typology : <?= $item->typology01() ?><br>
                        Client : <?= $item->client() ?><br>
                    </div>
                    <div class="terior-item-right">
                        <a href="<?= $item->url() ?>">
                        <?php if ($image = $item->image()) : ?>
                            <?= $image->resize(null, 520) ?>
                        <?php endif ?>
                        </a>
                    </div>
                </div>
            <?php endforeach ?>
    </div>
    <?php endif ?>
</main>

How should I add it here so that it works properly when connected with all tags?

<?php 
    $tag = param('tag');
    $works = page('works');
    $items = null;
    if ($works) {
    $items = $works->children()->listed();}
    if ($tag) {
        $items = $items->filterBy('category', $tag, ',');
    }
?>

I don’t really understand your question. Please describe your problem in more detail.

On a side note: It makes sense if you name your parameters like your field names, otherwise you will easily get confused when using multiple parameters. So if you field is called category, use a category url parameter etc.

thank you! I mean…
can you click hamburger menu in my site? https://groupseal.site/
there are two menu which is “exterior” and “architectural”.
I need to build "index"page so I choose tags option to separate “exterior” and “architectural”.

<?php 
    $tag = param('tag');
    $works = page('works');
    $items = null;
    if ($works) {
    $items = $works->children()->listed();}
    if ($tag) {
        $items = $items->filterBy('category', $tag, ',');
    }
?>
<main class="wrapper-main">
   <div class="terior-title">
    <?php if ($works = page('works')): ?>
        <?php if ($tag): ?>
            <h3>TYPOLOGY</h3>
            <h1><?= $tag ?></h1><br>
        <?php endif ?>
    </div>

    <div class="terior-content">
        <?php if ($items && $items->isNotEmpty()): ?>
            <?php foreach ($items->paginate(7) as $item): ?>
                <div class="terior-item">
                    <div class="terior-item-left">
                        <a href="<?= $item->url() ?>"><?= $item->title() ?></a><br>
                        <?= $item->year() ?><br><br>
                        Typology : <?= $item->typology01() ?><br>
                        Client : <?= $item->client() ?><br>
                    </div>
                    <div class="terior-item-right">
                        <a href="<?= $item->url() ?>">
                        <?php if ($image = $item->image()) : ?>
                            <?= $image->resize(null, 520) ?>
                        <?php endif ?>
                        </a>
                    </div>
                </div>
            <?php endforeach ?>
    </div>
    <?php endif ?>
</main>

this code is for works page.

and then…
could you go to my index page? : Design Group Seal

in this index page’s title, every title links to ‘works’ template. but my ‘works’ template has

<?php 
    $tag = param('tag');
    $works = page('works');
    $items = null;
    if ($works) {
    $items = $works->children()->listed();}
    if ($tag) {
        $items = $items->filterBy('category', $tag, ',');
    }
?>

this code!
so when I go to the url like this : Design Group Seal
they display every page. without flitering.
so I think… I need to add something to here " if ($tag) {
$items = $items->filterBy(‘category’, $tag, ‘,’);
}
?>" because there are 5 more tage except “category”.

Sorry for my poor explanation…But if you click on my link, you’ll know what I mean…

And you don’t want to link to the works page from your index page? Then you have to adapt the url of the link.

I said it before, if I were you, I’d name the tags like the field name

$category = param('category');
// url would look like this https://groupseal.site/category:exterior
$year = param('year');
// url would look like this https://groupseal.site/year:2022

etc. Then create the links accordingly.

Same for the works page itself.