ModX Revo: TagLister: Display Tag name on Tag page

214 Views Asked by At

what is the correct way to display the tag name on the tag specific page and a link to it in Modx revo using tagLister? e,g, a post has tags Tag1, Tag2 and Tag3. Now you click on one of the tags and it brings to the target resource displaying al posts with that single tag. What code to put in that target resource so it shows that the user has landed on the specific single tag page. I want to display the name and the link of that exact single tag.

My tags target resource is the main blog resource: Here is the code:

<section>
[[The Code to Display the Tag name to put here]]

[[!getResourcesTag@Blog Pagination Hy?
  &elementClass=`modSnippet`
  &element=`getResources`
  &tpl=`Blog Post on Blog Page`
  &hideContainers=`0`
  &pageVarKey=`page`
  &parents=`[[*id]]`
  &limit=`3`
  &includeTVs=`1`
  &includeContent=`1`
  &cache=`0`
]]
<div class="PaginationContainer">
<span class="TotalPages">p [[+page]] (total. [[+pageCount]])</span>
<ul>
[[!+page.nav]]
</ul>
</div>
</section>

is it possible at all?

1

There are 1 best solutions below

0
On

Finally found on the web. If you got better solution, please put it here.

So the idea is to make a snippet which gets the tag and call the snippet where we want.

Step by Step. Step 1. Make a new snippet and name it something, e.g. Tag Name, Step 2. Put the snippet code in the snippet code placeholder, Snippet code:

//-- Get all request string key/value pairs
$s = $_REQUEST;


if($s['key'] == 'tags'){
  return $s['tag'];
} else {
 return false;
}

Step 3. Call the snippet where you want the tag nam to show up, e.g. [[!Tag Name]]

It will show up the tag name on tag pages only.

Here is where I found it https://forums.modx.com/thread/11108/dynamically-generated-list-of-documents-that-are-tagged-with-categories?page=2#dis-post-397237