Answers.Body: <p>Try LinkIt. Allows you to set attributes.
  <a href="https://github.com/fruitstudios/LinkIt/blob/master/README.md" rel="nofollow">https://github.com/fruitstudios/LinkIt/blob/master/README.md</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-21T22:57:14.383Z
Answers.LastActivityDate: 2016-09-21T22:57:14.383Z
Answers.UserDisplayName: shorn
Answers.Body: <p>No, <code>getLink</code> outputs a very simple version of the link.</p>
  
  <p>If you want something more complex, you'll need to build it manually...</p>
  
  <pre><code>&lt;a href="{{ foo.url }}" class="bar"&gt;{{ foo.title }}&lt;/a&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-14T03:31:55.903Z
Answers.LastActivityDate: 2016-09-14T03:31:55.903Z
Answers.UserDisplayName: Lindsey D
Body: <p>This code: </p>
  
  <pre><code>{{ foo.getLink() }}
  </code></pre>
  
  <p>Outputs this:</p>
  
  <pre><code>&lt;a href="URL_HERE"&gt;NAME_OF_PAGE&lt;/a&gt;
  </code></pre>
  
  <p>What I really want is something like:</p>
  
  <pre><code>&lt;a href="URL_HERE" class="bar"&gt;NAME_OF_PAGE&lt;/a&gt;
  </code></pre>
  
  <p>Is it possible to set "class" and/or other html attributes when using Craft CMS Entry Property <a href="https://craftcms.com/docs/templating/entrymodel#getLink" rel="nofollow">getLink()</a>?</p>
  
Tags: <templating><link>
Title: Is it possible to set any attributes (such as a class) of the `a` tag when using `getLink()`?
ThreadText: # Is it possible to set any attributes (such as a class) of the `a` tag when using `getLink()`?
  
  (Asked by: username_0 on 2016-09-14)
  
  This code:
  
  ```
  {{ foo.getLink() }}
  
  ```
  
  Outputs this:
  
  ```
  <a href="URL_HERE">NAME_OF_PAGE</a>
  
  ```
  
  What I really want is something like:
  
  ```
  <a href="URL_HERE" class="bar">NAME_OF_PAGE</a>
  
  ```
  
  Is it possible to set "class" and/or other html attributes when using Craft CMS Entry Property [getLink()](https://craftcms.com/docs/templating/entrymodel#getLink)?
  
  **Tags:** templating, link
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2016-09-14. Score: 9 | Accepted answer
  
  No, `getLink` outputs a very simple version of the link.
  
  If you want something more complex, you'll need to build it manually...
  
  ```
  <a href="{{ foo.url }}" class="bar">{{ foo.title }}</a>
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2016-09-21. Score: 0
  
  Try LinkIt. Allows you to set attributes.
  <https://github.com/fruitstudios/LinkIt/blob/master/README.md>
  
  
  ---
  
  