# Crossreferences to index-pages in section not working

**URL:** <https://discourse.gohugo.io/t/crossreferences-to-index-pages-in-section-not-working/5321>\
**Category:** support\
**Created:** [February 3, 2017, 5:10am UTC](https://discourse.gohugo.io/t/crossreferences-to-index-pages-in-section-not-working/5321 "2017-02-03T05:10:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maria](https://avatars.discourse-cdn.com/v4/letter/m/34f0e0/32.png) [@maria](https://discourse.gohugo.io/u/maria)\
**Post date:** [February 3, 2017, 5:10am UTC](https://discourse.gohugo.io/t/crossreferences-to-index-pages-in-section-not-working/5321/1 "2017-02-03T05:10:51Z")

</div>

I am writing content with crossreferences to other files in other sections, which basically works well with `relref` or `ref`.

But I cannot link to the index file in each section.

The content folder holds an `_index` file on  
the top level of each section, the single files are index files beneath folders with the title (pretty URL). `_index.md` in each section is rendered with the list.html template.

Linking to another single page works, but I cannot link to the section index, which is a list file basically.

I treid several ways to call the section index file, but it seems that it is impossible since it is a list file?

---

<div class="post-metadata">

**Author:** ![calmh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/calmh/32/2858_2.png) [@calmh](https://discourse.gohugo.io/u/calmh)\
**Post date:** [March 22, 2017, 4:35am UTC](https://discourse.gohugo.io/t/crossreferences-to-index-pages-in-section-not-working/5321/2 "2017-03-22T04:35:31Z")

</div>

I too would like to know how to refer to listing pages with `ref` and `relref`. 🙂

---

<div class="post-metadata">

**Author:** ![rmspeers](https://avatars.discourse-cdn.com/v4/letter/r/dfb087/32.png) [@rmspeers](https://discourse.gohugo.io/u/rmspeers)\
**Post date:** [September 26, 2017, 2:24am UTC](https://discourse.gohugo.io/t/crossreferences-to-index-pages-in-section-not-working/5321/3 "2017-09-26T02:24:56Z")

</div>

I tried to solve this by setting a specific shortcode for relref to override the default one, based off of an example mentioned in [How to link to section pages with ref/relref shortcodes?](https://discourse.gohugo.io/t/how-to-link-to-section-pages-with-ref-relref-shortcodes/5952/13). See the code and location to put it here: [https://github.com/vjeantet/hugo-theme-docdock/blob/master/layouts/shortcodes/relref.html](https://github.com/vjeantet/hugo-theme-docdock/blob/master/layouts/shortcodes/relref.html). However, this has issues in a number of cases where it doesn’t work and prints the error string into the template:

```
{{- if in (.Get 0) "/_index.md" -}}
    {{- $path := (strings.TrimSuffix "_index.md" (.Get 0)) -}}
    {{- with .Site.GetPage "section" (trim $path "/") -}}
        {{- .URL -}}
    {{- else -}}
        {{- printf "MUST-DEFINE-TOP-LEVEL-SECTION" -}}
    {{- end -}}
{{- else -}}
    {{- .Get 0 | relref .Page -}}
{{- end -}}
```
