Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-18T06:55:48.493Z
Answers.Text: More readable in the code would be to use the following: `{% set page_cookies_policy = craft.entries.section('cookie-policy-single-handle').first() %}`
Answers.UserDisplayName: mrsmn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-16T08:01:40.443Z
Answers.LastActivityDate: 2017-09-16T08:01:40.443Z
Answers.UserDisplayName: denesis
Answers.Body: <p>An other solution, you can use:</p>
  <pre><code>{{craft.entries.section(&quot;yourHandleSectionName&quot;).one().url}}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-05T19:50:54.773Z
Answers.LastActivityDate: 2020-11-30T18:33:08.070Z
Answers.LastEditDate: 2020-11-30T18:33:08.070Z
Answers.UserDisplayName: Alexis Dalai Waldo Jiménez
Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-01-18T11:39:22.763Z
Answers.LastActivityDate: 2015-01-18T11:39:22.763Z
Answers.UserDisplayName: carlcs
Body: <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>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-01-18T00:56:14.893Z
Comments.Text: Can you update the original question with the error that it's giving you?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-01-18T06:31:18.030Z
Comments.Text: @BradBell probably it's: Craft\SectionModel and its behaviors do not have a method or closure named "url".
Comments.UserDisplayName: Marion Newlevant
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-01-18T10:12:09.453Z
Comments.Text: @BradBell, I updated the question.
Comments.UserDisplayName: Evin Wijninga
Tags: <url><singles>
Title: How do I get the url of single pages?
ThreadText: # 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 #}
  <nav class="nav">
      <ul class="hidden">
          {# Get all Sections #}
          {% set sections = craft.sections.getAllSections() %}
  
          {# Loop through all single sections #}
          {% for singleSection in sections if singleSection.type == 'single' %}
  
              {# Output #}
              <li class="">
                  <a href="{{ singleSection.url }}">
                      <div class="link">{{ singleSection }}</div>
                  </a>
              </li>
  
          {% endfor %}
      </ul>
  </nav>
  
  ```
  
  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**: @username_1 probably it's: Craft\SectionModel and its behaviors do not have a method or closure named "url".  
  > **username_0**: @username_1, 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() %}
  
  <a href="{{ singleSectionEntry.url }}">
      <div class="link">{{ singleSectionEntry.title }}</div>
  </a>
  
  ```
  
  
  ---
  
  ### 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() %}
  
     <ul class="footer-sub-nav">
         <li>{{ page_cookies_policy.getLink() }}</li>
         <li>{{ page_terms.getLink() }}</li>
     </ul>
  
  ```
  
  > **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}}
  
  ```
  
  
  ---
  
  