<p>To get an URL to a specific CraftCMS single entry.
Look up for the entry unique id in admin panel and then apply in Twig template:
Example below: </p>

<pre><code>   {% set page_cookies_policy = craft.entries.id(10).first() %}
   {% set page_terms = craft.entries.id(11).first() %}

   &lt;ul class="footer-sub-nav"&gt;
       &lt;li&gt;{{ page_cookies_policy.getLink() }}&lt;/li&gt;
       &lt;li&gt;{{ page_terms.getLink() }}&lt;/li&gt;
   &lt;/ul&gt;
</code></pre>

CC BY-SA 3.0
2017-09-18T06:55:48.493Z
More readable in the code would be to use the following: `{% set page_cookies_policy = craft.entries.section('cookie-policy-single-handle').first() %}`
mrsmn
CC BY-SA 3.0
2017-09-16T08:01:40.443Z
2017-09-16T08:01:40.443Z
denesis
<p>An other solution, you can use:</p>
<pre><code>{{craft.entries.section(&quot;yourHandleSectionName&quot;).one().url}}
</code></pre>

CC BY-SA 4.0
2020-11-05T19:50:54.773Z
2020-11-30T18:33:08.070Z
2020-11-30T18:33:08.070Z
Alexis Dalai Waldo Jiménez
<p>Craft creates an EntryModel for each Single Section, that allows you to access the URL property you are after. You can get the (one) EntryModel using the Section's ID and the <code>first()</code> method:</p>

<pre><code>{% set singleSectionEntry = craft.entries.sectionId(singleSection.id).first() %}

&lt;a href="{{ singleSectionEntry.url }}"&gt;
    &lt;div class="link"&gt;{{ singleSectionEntry.title }}&lt;/div&gt;
&lt;/a&gt;
</code></pre>

CC BY-SA 3.0
2015-01-18T11:39:22.763Z
2015-01-18T11:39:22.763Z
carlcs
<p>I've been struggling all evening with getting the urls of my singles in a menu generator. At first I thought I nailed it, but it turned out it used the title of the singles instead of the url. When I tried to get the url I an error, so clearly I'm doing something wrong.</p>

<p>This is the code to generate the menu:</p>

<pre><code>{# generating menu #}
&lt;nav class="nav"&gt;
    &lt;ul class="hidden"&gt;
        {# Get all Sections #}
        {% set sections = craft.sections.getAllSections() %}

        {# Loop through all single sections #}
        {% for singleSection in sections if singleSection.type == 'single' %}

            {# Output #}
            &lt;li class=""&gt;
                &lt;a href="{{ singleSection.url }}"&gt;
                    &lt;div class="link"&gt;{{ singleSection }}&lt;/div&gt;
                &lt;/a&gt;
            &lt;/li&gt;

        {% endfor %}
    &lt;/ul&gt;
&lt;/nav&gt;
</code></pre>

<p>It is the <code>singleSection.url</code> that causes the error. </p>

<p><code>Craft\SectionModel and its behaviors do not have a method or closure named “url”.</code></p>

<p>I presume the SectionModel does not have an Url, but that doesn't bring me any close to solving my problem of getting the url of single pages.</p>

CC BY-SA 3.0
2015-01-18T00:56:14.893Z
Can you update the original question with the error that it's giving you?
Brad Bell
CC BY-SA 3.0
2015-01-18T06:31:18.030Z
@BradBell probably it's: Craft\SectionModel and its behaviors do not have a method or closure named "url".
Marion Newlevant
CC BY-SA 3.0
2015-01-18T10:12:09.453Z
@BradBell, I updated the question.
Evin Wijninga
<url><singles>
How do I get the url of single pages?
# How do I get the url of single pages?

(Asked by: username_0 on 2015-01-18)

I've been struggling all evening with getting the urls of my singles in a menu generator. At first I thought I nailed it, but it turned out it used the title of the singles instead of the url. When I tried to get the url I an error, so clearly I'm doing something wrong.
This is the code to generate the menu:
{# generating menu #}

    
        {# Get all Sections #}
        {% set sections = craft.sections.getAllSections() %}

        {# Loop through all single sections #}
        {% for singleSection in sections if singleSection.type == 'single' %}

            {# Output #}
            
                
                    {{ singleSection }}
                
            

        {% endfor %}
    


It is the singleSection.url that causes the error. 
Craft\SectionModel and its behaviors do not have a method or closure named “url”.
I presume the SectionModel does not have an Url, but that doesn't bring me any close to solving my problem of getting the url of single pages.

**Tags:** url, singles
> **Comments:**
> **username_1**: Can you update the original question with the error that it's giving you?  
> **username_2**: @BradBell probably it's: Craft\SectionModel and its behaviors do not have a method or closure named "url".  
> **username_0**: @BradBell, I updated the question.  

---

## 3 answers

### Answer by username_6 on 2015-01-18. Score: 8 | Accepted answer

Craft creates an EntryModel for each Single Section, that allows you to access the URL property you are after. You can get the (one) EntryModel using the Section's ID and the first() method:
{% set singleSectionEntry = craft.entries.sectionId(singleSection.id).first() %}


    {{ singleSectionEntry.title }}


---

### Answer by username_3 on 2017-09-16. Score: 2

To get an URL to a specific CraftCMS single entry.
Look up for the entry unique id in admin panel and then apply in Twig template:
Example below: 
   {% set page_cookies_policy = craft.entries.id(10).first() %}
   {% set page_terms = craft.entries.id(11).first() %}

   
       {{ page_cookies_policy.getLink() }}
       {{ page_terms.getLink() }}

> **Comments:**
> **username_4**: More readable in the code would be to use the following: `{% set page_cookies_policy = craft.entries.section('cookie-policy-single-handle').first() %}`  

---

### Answer by username_5 on 2020-11-05. Score: 2

An other solution, you can use:
{{craft.entries.section("yourHandleSectionName").one().url}}


---

