Skip to content

[Blade Templates] How to show associated blog content from a tag? #4775

Discussion options

You must be logged in to vote

Hmm, I wanted to avoid doing a collection query when I'm already in the blog/tags/show.blade.php page and use entries like the statamic video did. Since entries does exist there and it shows the correct count for all associated values with that said tag.

    @collection('blog', ['taxonomy:tags' => "$slug", 'sort' => 'date:desc'])
        {{ dd($entry) }}
    @endcollection

^^ Just adding the correct query for Statamic Blade Plugin here incase someone else needs to do the same.

Edit Real Answer

I figured out a better solution. Since it's an EntryQueryBuilder, we can do all the same commmands as Content Queries. Which means we can run entries->get() to get all the associated blog articles. ie

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by MeikyuuTrader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants