> For the complete documentation index, see [llms.txt](https://playground.e107sk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://playground.e107sk.com/plugin-dev-quick-notes/how-to-1/page-tags-shortcode.md).

# Page tags shortcode

```
/**
 * {THEME_PAGE_TAGS} - the current page's keywords, each one linked to the matching news list.
 */
function sc_theme_page_tags($parm = array())
{
	$page = e107::getScBatch('page', null, 'cpage')->getVars();

	if(!is_array($page) || empty($page['page_metakeys']))
	{
		return '';
	}

	$tp        = e107::getParser();
	$class     = !empty($parm['class']) ? $parm['class'] : 'page-tag';
	$separator = isset($parm['separator']) ? $parm['separator'] : ', ';
	$links     = array();

	foreach(explode(',', $page['page_metakeys']) as $tag)
	{
		$tag = trim($tag);

		if($tag === '')
		{
			continue;
		}

		$url = e107::getUrl()->create('news/list/tag', array('tag' => str_replace(' ', '-', $tag)));
		$links[] = "<a class='".$class."' href='".$url."'>".$tp->toHTML($tag, false, 'SUMMARY')."</a>";
	}

	return implode($separator, $links);
}
```

Related: <https://github.com/e107inc/e107/issues/3090#issuecomment-5555038520>
