Answers.Body: <p>I found a way to use the <a href="https://github.com/mmikkel/RetconHTML-Craft/wiki/Attr" rel="nofollow noreferrer">RetconHTML</a> plugin for what I wanted. I just utilized the Attr filter and it worked the way I wanted. I had to also remove the way Retcon would add spaces to appended strings.</p>
  
  <pre><code>{{ block.paragraph | retconAttr('a', { href : '?some_text' ~ entry.title|kebab }, false) }}
  </code></pre>
  
  <p>By including <code>false</code>, it adds to the already existing href, rather than overwriting it. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-12T14:36:51.437Z
Answers.LastActivityDate: 2018-02-13T15:20:42.207Z
Answers.LastEditDate: 2018-02-13T15:20:42.207Z
Answers.UserDisplayName: Morgan
Body: <p>I'm trying to append a string to the end of all rich text links. Is there an already existing plugin for this?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-07T15:01:28.087Z
Comments.Text: I don't think there is a clean way to solve this without using/creating a plugin or at least a twig filter. Twig itself is not supposed to contain business logic and even so there are no build-in functions to attach string into a text at specific places. You can't "find" links in the Rich Text Field by default, so you'll need a regex or something like that. However within the last 4 Years I didn't create a single site without creating a custom plugin for it, so I don't see any reason to not use/create one
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-07T15:11:20.317Z
Comments.Text: Thanks for your response @RobinSchambach. I figured I would have to use a plugin. I was told to try and not use one, only because when Craft 3 comes out and we switch to that, there's the concern as to whether any plugins we're using will be compatible, so we don't want to rely heavily on them.
Comments.UserDisplayName: Morgan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-07T15:48:48.423Z
Comments.Text: I see. Thats makes sense but my suggestion would be to start with Craft 3 from the beginning and create your own plugins. It's far better to start to develop with Craft 3 instead of doing everything with Craft 2 and update afterwards, because there are twig token (includeJs/includeCssRessource and all these) that won't work anymore after your update. Since you'll probably have to change all your Rich Text Fields too because Craft3 does not come up with this field type  by default you'll have to download the plugin anyway. Just as a hint. You'll have much more work with your way
Comments.UserDisplayName: Robin Schambach
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-07T21:16:09.900Z
Comments.Text: Do you know of a way to append text to the end of a link? I have to do it the manual way, as that's they only method I can utilize for how we handle tracking links.
Comments.UserDisplayName: Morgan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-02-07T21:31:36.063Z
Comments.Text: You can create a twig filter that searches all links in the text (regex) https://stackoverflow.com/questions/23366790/php-find-all-links-in-the-text and replace those values with the same value + the string you like to append https://www.w3schools.com/php/func_string_str_replace.asp
Comments.UserDisplayName: Robin Schambach
Tags: <redactor><string><querystring>
Title: Append a string to the end of all rich text links
ThreadText: # Append a string to the end of all rich text links
  
  (Asked by: username_0 on 2018-02-07)
  
  I'm trying to append a string to the end of all rich text links. Is there an already existing plugin for this?
  
  **Tags:** redactor, string, querystring
  
  > **Comments:**
  > **username_1**: I don't think there is a clean way to solve this without using/creating a plugin or at least a twig filter. Twig itself is not supposed to contain business logic and even so there are no build-in functions to attach string into a text at specific places. You can't "find" links in the Rich Text Field by default, so you'll need a regex or something like that. However within the last 4 Years I didn't create a single site without creating a custom plugin for it, so I don't see any reason to not use/create one  
  > **username_0**: Thanks for your response @username_1. I figured I would have to use a plugin. I was told to try and not use one, only because when Craft 3 comes out and we switch to that, there's the concern as to whether any plugins we're using will be compatible, so we don't want to rely heavily on them.  
  > **username_1**: I see. Thats makes sense but my suggestion would be to start with Craft 3 from the beginning and create your own plugins. It's far better to start to develop with Craft 3 instead of doing everything with Craft 2 and update afterwards, because there are twig token (includeJs/includeCssRessource and all these) that won't work anymore after your update. Since you'll probably have to change all your Rich Text Fields too because Craft3 does not come up with this field type  by default you'll have to download the plugin anyway. Just as a hint. You'll have much more work with your way  
  > **username_0**: Do you know of a way to append text to the end of a link? I have to do it the manual way, as that's they only method I can utilize for how we handle tracking links.  
  > **username_1**: You can create a twig filter that searches all links in the text (regex) https://stackoverflow.com/questions/23366790/php-find-all-links-in-the-text and replace those values with the same value + the string you like to append https://www.w3schools.com/php/func_string_str_replace.asp  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-02-12. Score: 1 | Accepted answer
  
  I found a way to use the [RetconHTML](https://github.com/mmikkel/RetconHTML-Craft/wiki/Attr) plugin for what I wanted. I just utilized the Attr filter and it worked the way I wanted. I had to also remove the way Retcon would add spaces to appended strings.
  
  ```
  {{ block.paragraph | retconAttr('a', { href : '?some_text' ~ entry.title|kebab }, false) }}
  
  ```
  
  By including `false`, it adds to the already existing href, rather than overwriting it.
  
  
  ---
  
  