Tags as url to unlisted pages

Hi everyone, I am stuck and need little help on how to link to an unlisted pages when tag is clicked on the blog page.
I have created pages similar to blog page but it only displays articles that contain the same tag.
I want to be able to go from the blog page to the unlisted pages when tag is clicked on.

here’s the tags code:
`<?= $article->tags() ?>
how can I add dynamic link to it?

Does the tags field only ever contain one value? Or can there be multiple tags?

Just one value

Then you need to wrap it into an a tag with a url to the pag

<?php $tag = $article->tags(); ?>
<?php if ( $p = page($tag) ) : ?>
    <a href="<?= $p->url() ?>"><?= $tag ?></a>
<?php else : ?>
    <?= $tag ?>
<?php endif ?>

If the id to the tag page is different, then you have to adapt the url accordingly.

Thanks, It works

Please one last thing, I want the icon to be dynamic according to the chosen tag

is it possible?

Sure, everything is possible. The question is just how you assign the icon to the tag. You would either have to link them by name or create an array where you assign an icon to each tag, then fetch the icon from this array.

Furthermore, it depends on whether you use a fixed set of icons/tags, or if the user should somehow be able to set such icon/tag combinations in the Panel.

I do not now how to do this
I want each icon to be fetched when the name is fetched

Well, as I said you first have to think about how you want to connect the tag and the icon. Once you know how you want to do this, then the second step would be to find a way to do that.

the tags are inputs from the panel but we have the categories, i want the icon to be selected based on the tag inserted, it is just one tag per article.

Still, it probably wouldn’t make sense to add a field for the matching icon in every page.

can’t I make it a single field but the appropriate icon should be selected according to the name

just like this but for icons instead of the page

You could set up a structure field with two fields for the tagname and the icon, e.g. in the parent page, where you can match icon and tag. Then when you output the tag in your template, fetch the matching icon from there.

I do not understand this

can you show me an example?

See the social structure field in about.yml in the Starterkit and the docs about that field.

seems you do not understand my request, I want to assign an icon to a tag in my article.
I know how to do structure.

I do very well understand your request but unfortunately you have answered none of my questions and especially not where you have stored your icons or how they are connected to the tags. Without this information its not possible to help you.