<p>Expanding a little bit more on <a href="https://craftcms.stackexchange.com/users/4554/dustin-c">Dustin C</a> <a href="https://craftcms.stackexchange.com/a/16180/7855">solution</a>. </p>

<p>It is possible to get the <a href="https://docs.craftcms.com/v3/config/config-settings.html#siteurl" rel="nofollow noreferrer">siteURL</a> instead of hard coding it:</p>

<pre class="lang-php prettyprint-override"><code>&lt;a href="{{ siteUrl }}{{ entry.section.name|kebab }}"&gt;{{ entry.section }}&lt;/a&gt;
</code></pre>

CC BY-SA 4.0
2019-11-19T02:57:26.873Z
2019-11-19T02:57:26.873Z
Alex Ljamin
<p>Here's what I did. You'll need to set <code>sectionId</code> first.</p>

<p><code>{% set thing = craft.sections.getSectionById(sectionId) %}</code>
<code>{{thing.getUrlFormat()|split('/')[0]}}</code></p>

CC BY-SA 4.0
2019-11-19T01:25:23.160Z
In the newest version of Craft `getSectionById` query should be expanded with `craft.app.sections.getSectionById(sectionId)`
Alex Ljamin
CC BY-SA 3.0
2015-06-12T22:28:58.240Z
2015-06-12T22:28:58.240Z
Brandon Fredericksen
<p>I know this is a year old, but I was scratching around trying to find a solution to this, and I came up with this.</p>

<p>Try the kebab modifier.</p>

<pre><code>&lt;a href="http://example.com/{{ entry.section|kebab }}"&gt;{{ entry.section }}&lt;/a&gt;
</code></pre>

<p>The kebab case makes it possible to convert your section titles to usable links -- at least they did in my case.</p>

<p>Hope this helps someone in the future.</p>

CC BY-SA 3.0
2016-08-03T00:08:19.850Z
2016-08-03T00:08:19.850Z
Dustin C
<p>Currently there is no method to get the link to the section's index page. However, if you try to visit <a href="http://domain.com/sectionhandle/" rel="nofollow">http://domain.com/sectionhandle/</a>, it will will try to load a template named index.html inside a folder named after your sectionhandle.</p>

<p>In your example:</p>

<pre><code>http://domain.com/places/ -&gt; templates/**places/index.html
</code></pre>

<p>I think that you can easily make that assumption and use that in a link. It's not elegant, and it doesn't take into account locales, but.. It's the only way at the moment, I think.</p>

CC BY-SA 3.0
2014-10-01T12:14:11.197Z
The issue is that the URL and the sectionHandle don't necessarily correspond so it's not a reliable way of doing it.
hamishtaplin
CC BY-SA 3.0
2014-10-01T12:28:18.770Z
That is true. What about getting the url format through getUrlFormat(), and then get the first segment via the split('/') filter?
Fred Carlsen
CC BY-SA 3.0
2014-10-01T14:02:15.253Z
Yes, that is the approach I have been taking so far.
hamishtaplin
CC BY-SA 3.0
2014-10-01T14:58:54.667Z
You could also create a separate structure for your index pages, which would allow you to specify an exact url.
Douglas McDonald
CC BY-SA 3.0
2014-10-01T15:19:57.940Z
Or create routes to the index pages. It would be nice to just be able to define an index page within the section configuration though. Something like, "<checkbox> this section has an index page". And "Index page URL format" for each locale.
Douglas McDonald
CC BY-SA 3.0
2014-10-01T10:50:34.557Z
2014-10-01T10:50:34.557Z
Fred Carlsen
<p>Similar to this question: <a href="https://craftcms.stackexchange.com/questions/2743/output-url-to-section">Output URL to section</a></p>

<p>Let's say we have a section with handle 'places' which defines its URL format as 'places/{slug}'—how do I get the link to the 'places' index page? The question above goes via the entries in that section but that just gets the url of the first entry in that section.</p>

<sections>
Get the URL of a section?
# Get the URL of a section?

(Asked by: username_0 on 2014-10-01)

Similar to this question: [Output URL to section](https://craftcms.stackexchange.com/questions/2743/output-url-to-section)

Let's say we have a section with handle 'places' which defines its URL format as 'places/{slug}'—how do I get the link to the 'places' index page? The question above goes via the entries in that section but that just gets the url of the first entry in that section.

**Tags:** sections

---

## 4 answers

### Answer by username_1 on 2019-11-19. Score: 3

Expanding a little bit more on Dustin C solution. 
It is possible to get the siteURL instead of hard coding it:
{{ entry.section }}


---

### Answer by username_2 on 2015-06-12. Score: 3

Here's what I did. You'll need to set `sectionId` first.

`{% set thing = craft.sections.getSectionById(sectionId) %}`
`{{thing.getUrlFormat()|split('/')[0]}}`

> **Comments:**
> **username_1**: In the newest version of Craft `getSectionById` query should be expanded with `craft.app.sections.getSectionById(sectionId)`  

---

### Answer by username_3 on 2016-08-03. Score: 2

I know this is a year old, but I was scratching around trying to find a solution to this, and I came up with this.
Try the kebab modifier.
{{ entry.section }}

The kebab case makes it possible to convert your section titles to usable links -- at least they did in my case.
Hope this helps someone in the future.


---

### Answer by username_4 on 2014-10-01. Score: 1

Currently there is no method to get the link to the section's index page. However, if you try to visit http://domain.com/sectionhandle/, it will will try to load a template named index.html inside a folder named after your sectionhandle.
In your example:
http://domain.com/places/ -> templates/**places/index.html

I think that you can easily make that assumption and use that in a link. It's not elegant, and it doesn't take into account locales, but.. It's the only way at the moment, I think.

> **Comments:**
> **username_0**: The issue is that the URL and the sectionHandle don't necessarily correspond so it's not a reliable way of doing it.  
> **username_4**: That is true. What about getting the url format through getUrlFormat(), and then get the first segment via the split('/') filter?  
> **username_0**: Yes, that is the approach I have been taking so far.  
> **username_5**: You could also create a separate structure for your index pages, which would allow you to specify an exact url.  
> **username_5**: Or create routes to the index pages. It would be nice to just be able to define an index page within the section configuration though. Something like, "<checkbox> this section has an index page". And "Index page URL format" for each locale.  

---

