Forum
Blog App Tag Links
Hi, In the Blog App is there a template tag to automatically get the link to the specific tag category. I know you can pull the tag name automatically, but how do you get the tag name to bring them to a page where they can see all the posts with that tag? Thanks
You would filter on tag, I believe the files that you download contain an example of doing that on the archive listing, but otherwise it's all in the docs:
https://docs.grabaperch.com/addons/blog/page-functions/custom/
You just pass in a tag or tags as an array.
Hi Rachel,
Thanks, but I don't think that's quite what I'm looking for. In my blog templates I've adjusted the "post_in_list.html" to my liking, but I'd like the tag category title to also be a link to the tag category listing automatically. What I'm looking for is the automated link association. I'll show you my code. I put in code brackets what I'm trying to adjust.
I hope this makes sense.
Hi Greg,
I think your template code would need something like this to list out the tags:
This should (as an example) direct the query to an archive page using the slug for the tag.
If you check the "archive.php" within the blog download files, the code to display a list of posts by tag looks like this:
You could alternatively create a "tags.php" page to use rather than "archive.php" and loose the IF statement, etc…
Thank you for your reply. This looks like what I need. I'll give it a try! Thanks!
I'm not getting anywhere. When I click on the tag, it takes me to the full archive of posts rather than the filtered tag. This is what I have.
I'm looking to get the tag link from the post tag title it's pulling.
Does the tag appear on the URL?
No it doesn't. It ends like this: mysite.com/archive.php?tag=
Ok, that's why the archive page isn't filtering - it's got nothing to filter with
Check your template that is creating the link.
Not sure what to check for in the template, that's my problem. Here's my code for the post_in_list.html. Thanks.
You're using
tagSlug
, but in that context there could be lots of tags - so which slug is it?To link the individual tags in a listing you'll need to process them before the template.
and then in your template
Thanks Drew. Would I add the php code to the archive.php or as a new php file?
Add the
each
option to your existing code where you're creating the listing.