Answers.Body: <p>If you truly want to this via a custom field:</p>
  <ol>
  <li>Admin &gt; Settings &gt; Fields is where you create custom fields.</li>
  <li>Settings &gt; Sections &gt; Edit Entry Type is where you assign custom fields to your section. You drag and drop the field under &quot;Design Your Field Layout&quot;.</li>
  <li>You can then output the custom field in your template using {{ entry.customFieldHandle }} for example.</li>
  </ol>
  <p>A more common approach would be to code this tag in your templates instead of using a custom field. I can't give you a very specific approach to try with the code since I do not know your site structure and desired result.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-26T02:23:56.710Z
Answers.LastActivityDate: 2021-05-26T02:23:56.710Z
Answers.UserDisplayName: triplethreat23
Answers.Body: <p>First, I would recommend looking at the SEOmatic plugin - it does all of this for you, and a whole lot more.</p>
  
  <p>If you want to go it on your own, though, I would just use <code>{{ craft.request.url }}</code> rather than adding your own field. Craft already knows what the URL is.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-23T06:34:49.337Z
Answers.Text: Thanks for that, I'll have a look at the plugin. As for craft.request.url, I need to be able to put in url's for other pages rather than the same page. Any solution to that? Thanks
Answers.UserDisplayName: Gazz
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-19T07:50:25.913Z
Answers.Text: {{ craft.request.url }} uses the current URL. so, it will produce different results for www.site.com and site.com, thus defeating the purpose of canonical links.
Answers.UserDisplayName: aaandre
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-31T06:17:23.433Z
Answers.Text: terrible answer. as @aaandre said this defeats the purpose of the tag.
Answers.UserDisplayName: Rick Kukiela
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-22T23:43:54.173Z
Answers.LastActivityDate: 2017-06-22T23:43:54.173Z
Answers.UserDisplayName: Patrick Harrington
Body: <p>What is the best way of creating a custom field for each page whereby the user can input a URL into a field, which then gets input into a rel=canonical element like the example below.</p>
  
  <pre><code>&lt;link rel="canonical" href="{{URL_FROM_CUSTOM_FIELD}}"&gt;
  </code></pre>
  
  <p>I already have an SEO tab like in the image below, however I am unsure of how to create a custom field inside this tab. </p>
  
  <p><a href="https://i.sstatic.net/oCrRi.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oCrRi.png" alt="enter image description here"></a></p>
  
  <p>If someone could point me in the right direction, that would be great, as I am very new to the CMS.</p>
  
Tags: <templating><custom-field>
Title: Create custom field to input canonical url in a page
ThreadText: # Create custom field to input canonical url in a page
  
  (Asked by: username_0 on 2017-06-22)
  
  What is the best way of creating a custom field for each page whereby the user can input a URL into a field, which then gets input into a rel=canonical element like the example below.
  
  ```
  <link rel="canonical" href="{{URL_FROM_CUSTOM_FIELD}}">
  
  ```
  
  I already have an SEO tab like in the image below, however I am unsure of how to create a custom field inside this tab.
  
  [![enter image description here](https://i.sstatic.net/oCrRi.png)](https://i.sstatic.net/oCrRi.png)
  
  If someone could point me in the right direction, that would be great, as I am very new to the CMS.
  
  **Tags:** templating, custom-field
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2021-05-26. Score: 1
  
  If you truly want to this via a custom field:
  
  1. Admin > Settings > Fields is where you create custom fields.
  2. Settings > Sections > Edit Entry Type is where you assign custom fields to your section. You drag and drop the field under "Design Your Field Layout".
  3. You can then output the custom field in your template using {{ entry.customFieldHandle }} for example.
  
  A more common approach would be to code this tag in your templates instead of using a custom field. I can't give you a very specific approach to try with the code since I do not know your site structure and desired result.
  
  
  ---
  
  ### Answer by username_2 on 2017-06-22. Score: 0
  
  First, I would recommend looking at the SEOmatic plugin - it does all of this for you, and a whole lot more.
  
  If you want to go it on your own, though, I would just use `{{ craft.request.url }}` rather than adding your own field. Craft already knows what the URL is.
  
  > **Comments:**
  > **username_0**: Thanks for that, I'll have a look at the plugin. As for craft.request.url, I need to be able to put in url's for other pages rather than the same page. Any solution to that? Thanks  
  > **username_3**: {{ craft.request.url }} uses the current URL. so, it will produce different results for www.site.com and site.com, thus defeating the purpose of canonical links.  
  > **username_4**: terrible answer. as @username_3 said this defeats the purpose of the tag.  
  
  ---
  
  