Show specific tag

Using this code I saw all tags’ blog. Ok, it works.

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

What if I should show only a specific tag what is the right code?
For example, I have five tags, but I want to show only two.

How would you choose which tags to show? Select them somehow? Always want to show only two? the first two? Random two out of all five?

I want choose which tags to show and how many (2 or 3)

For my understanding hone: why does the page have even more than those chosen tags?

Because the page is the archive of all posts, but I want to show (and to link) only the main topics (2 or 3).

I already added them manually, but I wonder if there is another way.

You could add a new tags field to the archive page that pulls in all used tags from the posts as options. And there you can then choose which ones to use on the archive page.

Pulling in the used tags as options on the archive page (assuming the posts are direct children of the archive page):

query: page.children.pluck("theTagFieldNameOnPostPage", ",", true)

I hadn’t thought about the tags of the archive page. I tried and got what I wanted to do.

Thanks :slight_smile: