Page 1 of 1

cms_selflink will not output link on all pages

Posted: Fri Sep 25, 2020 7:30 am
by jpa
I have an issue with cms_selflink within the normal page contents.

On most pages, links like:

Code: Select all

<a href="{cms_selflink href='alias'}">
Works fine, and output the full correct URL to this page. But on some pages, this is the result:

Code: Select all

https://my.site.no/%7Bcms_selflink%20href='alias'%7D
The pages use the same design and template. The content uses the MicroTiny editor, and I notice that when I hover the link in MicroTiny, I see the above, not converted, link. But on most pages the preview is OK. But not on all pages. I've tried to edit the link and page, but it does not help.

I just upgraded to the latest version 2.2.14 (from 2.2.12). The content itself was earlier upgraded from an old 1.11.* version a few months back. It could be that this error occurred then. But why is it not working post editing on this pages?

I found an older post with this issue regaring the News module, but the cms_selflink works fine in the News module of my CMS. And since it works fine on most content pages, I cannot see that this solution is helpful here.

Re: cms_selflink will not output link on all pages

Posted: Fri Sep 25, 2020 11:56 am
by velden
If you disable the wysiwyg editor (MicroTiny) for a problematic page (Options tab); do you see the un-encoded {cms_selflink href='alias'} or the encoded %7Bcms_selflink%20href='alias'%7D?

You could then fix it in the html code and enable the wysiwyg editor afterwards

Re: cms_selflink will not output link on all pages

Posted: Fri Sep 25, 2020 8:01 pm
by jpa
Thank you for your replay.

When I disable WYSIWYG (or view HTML source) I see the un-encoded tag: <a href="{cms_selflink href='alias'}"> on every occation.

When I save the page with disabled WYSIWYG and view the page, the links are still encoded like %7Bcms_selflink%20href='alias'%7D

Re: cms_selflink will not output link on all pages

Posted: Fri Sep 25, 2020 8:11 pm
by DIGI3
On the pages where it isn't working, are they using the same page template as the ones where it works? If you add another Smarty tag in the same content block as the link does it get processed, or are they all skipping Smarty evaluation? Try {$smarty.now} or something as a test.

Re: cms_selflink will not output link on all pages

Posted: Fri Sep 25, 2020 8:21 pm
by jpa
Just found the culprit. Saw it when I took another look at the source code.
One way or another the whole page content was put inside a

Code: Select all

{literal}
tag. I removed this tag and put it around only the text that needed it.

And violà!

Thanks for all your suggestions. I'll get new glasses and show myself out 🙂