I have currently on this page: https://www.domain.com/landing-pages/programs/abc-program/details
I would like to dynamically place the last section of the URL into a link on this page like this: <a href="/another-page?program=abc-program">Click here.</a>
<a href="/another-page?program=abc-program">Click here.</a>
When I use the following syntax, it doesn't work due to the double quotes that are already surrounding the HREF. <a href="/another-page?program={% CurrentDocument.NodeAliasPath.Split("/")[2] @%}">Click here.</a>
<a href="/another-page?program={% CurrentDocument.NodeAliasPath.Split("/")[2] @%}">Click here.</a>
What is the best way around this?
Change the double quotes around the href attribute to single quotes. Should resolve the problem and still be valid HTML. We do it all the time, no issues.
I had already tried that. It does work the first time you save, but it reverts back to double quotes whenever I go back in to make another other edits to the content block.
You must be doing this in a WYSIWYG editor field then. I'd suggest making a change then and not using the WYSIWYG field and maybe just a text area.
I'm the only programmer within an organization of content editors. They're not going to let me remove the WYSIWYG.
Is there any other way around it?
Check out the CKEditor documentation to see if you can make a configuration change on the editor. That's outside of Kentico but you can make a config change in the /CMSAdministration/CKEditor/config.js
Please, sign in to be able to submit a new answer.