# Identify if shortcode is rendering in a .summary

**URL:** <https://discourse.gohugo.io/t/identify-if-shortcode-is-rendering-in-a-summary/22962>\
**Category:** support\
**Created:** [January 22, 2020, 5:47pm UTC](https://discourse.gohugo.io/t/identify-if-shortcode-is-rendering-in-a-summary/22962 "2020-01-22T17:47:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dox](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/dox/32/8202_2.png) [@Dox](https://discourse.gohugo.io/u/Dox)\
**Post date:** [January 22, 2020, 5:47pm UTC](https://discourse.gohugo.io/t/identify-if-shortcode-is-rendering-in-a-summary/22962/1 "2020-01-22T17:47:29Z")

</div>

I’ve use `[text](#anchor-link)` in posts and they work really well for my use cases. I’ve also used {{ ref/relref }} too.

I’ve hacked together a shortcode that lists/links all the posts in the current page’s series and outputs them with a nice header and a “_(this post)_” tag on the current one. I then add this at the end of each post/page that’s part of a series. I added a “series” anchor ID to the shortcode output so I could simply link to it with something like `[this series](#series)` anywhere in the post.

This works great except where the `#series` anchor is referenced in the summary above my `<!--more-->` tag. On the full, single page itself, it renders correctly. On the home/list page in the summary it renders relative to the list page itself of course, so `site-root/#series`. I can fix that by being more explicit with a {{ ref }} in the link if it’s in the summary section, I know.

However, what I’m now trying to do (and failing) is to create a shortcode which within the full single page creates a link to the list of links at the end of that post, but, on the summary, jumps to the series’s list page. In pseudo-code it would look something like this (broken out into two ifs for clarity);

```
{{ if renderedInSinglePage }}
     <a href="#series">series</a>
{{ end }}
{{ if renderedInListSummary }}
    <a href="/series/[page-params-series-url]">series</a>
{{ end }}

```

I know how to get at the page’s series param and urlize that, what I can’t find is a way to work out if the shortcode is rendering in the full page or the .Page.Summary on a list page. If I display {{ .IsPage }} in the shortcode, I get `true` in both cases and similarly with `.Kind` I get ‘page’ in both.

Hopefully there’s a simple answer I’m missing, but either way, any help gratefully received.
