Using pinterest embed - Saving node - Image url is changed
Hello,
I'm trying to paste in an embed code from Pinterest in a content element, through an RTE, in my CMS. I click on "html" on the RTE, paste in my code, update. Then I see the Pinterest embed correctly displayed. Then I save. once I save it doesn't work anymore my image SRC was changed. It was http://whatver.com/[...].jpg, now it's /whatever.com/[...].jpg. Which makes little or no sense.
What is doing this (umbraco saving it seams?) and how can I go around this?
What version of Umbraco are you using? If it's not 4.9 then you should open up the umbracoSettings.config file (found in the config folder) and set this line from
<TidyEditorContent>True</TidyEditorContent>
to
<TidyEditorContent>False</TidyEditorContent>
It's previously not been a best practice to do so, since this opens up for a lot of bad and outdated markup to be rendered as the output if for some reason someone think it's still cool to use <font> tags etc. :) - But with the new HTML5 elements and a growing need to be able to embed stuff like youtube videos, pinterest stuff etc. it does not neccesarily make sense to have tidy clean the code before it's being rendered.
If you howver would like to still have tidy enabled you can create macro based on the multi text option, and make sure the macro can be used in the rich text editor and then you can paste your pinterest code in to the macro and render the rich text output.
Finally got around to work on this issue some more, I tried to change the setting you mentionned but it did not work. I get the same behavior.
I reset IIS after changing the setting to make sure it was re-loaded, but no change. I'm running on Umbraco 4.7.2.
I tried a quick and dirty macro to do this:
@using umbraco.MacroEngines
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
var code = "";
if (!string.IsNullOrEmpty(GetParameter("Code")))
{
code = GetParameter("Code");
}
}
@code
Which would basically allow any HTML, but the rendered HTML still got reformated, notably, the image src changed and a slew of other problems showed up, I'm already printing my RTE through a razor macro. So then, that's like a macro in a macro and just like that I don't think it's supported.
But the problem actually occurs right away on the back office side (then also in front end). When I insert the pinterest code in the RTE I see the image correctly, just saving that node then will cause the bug.
Honestly, I'm surprised no one else has had this issue? There must something I'm missing and or doing wrong...
I'll try some more stuff next week and post this to twitter to get more guns on the issue.
EDIT: Ok editing posts completely destroys them lol...
Using pinterest embed - Saving node - Image url is changed
Hello,
I'm trying to paste in an embed code from Pinterest in a content element, through an RTE, in my CMS. I click on "html" on the RTE, paste in my code, update. Then I see the Pinterest embed correctly displayed. Then I save. once I save it doesn't work anymore my image SRC was changed. It was http://whatver.com/[...].jpg, now it's /whatever.com/[...].jpg. Which makes little or no sense.
What is doing this (umbraco saving it seams?) and how can I go around this?
I can't really not support this...
Thanks!
Hi Sébastian
What version of Umbraco are you using? If it's not 4.9 then you should open up the umbracoSettings.config file (found in the config folder) and set this line from
<TidyEditorContent>True</TidyEditorContent>
to
<TidyEditorContent>False</TidyEditorContent>
It's previously not been a best practice to do so, since this opens up for a lot of bad and outdated markup to be rendered as the output if for some reason someone think it's still cool to use <font> tags etc. :) - But with the new HTML5 elements and a growing need to be able to embed stuff like youtube videos, pinterest stuff etc. it does not neccesarily make sense to have tidy clean the code before it's being rendered.
If you howver would like to still have tidy enabled you can create macro based on the multi text option, and make sure the macro can be used in the rich text editor and then you can paste your pinterest code in to the macro and render the rich text output.
Hope this helps!
/Jan
Hi Jan,
Finally got around to work on this issue some more, I tried to change the setting you mentionned but it did not work. I get the same behavior.
I reset IIS after changing the setting to make sure it was re-loaded, but no change. I'm running on Umbraco 4.7.2.
I tried a quick and dirty macro to do this:
Which would basically allow any HTML, but the rendered HTML still got reformated, notably, the image src changed and a slew of other problems showed up, I'm already printing my RTE through a razor macro. So then, that's like a macro in a macro and just like that I don't think it's supported.
Here is the pinterest code as a reference.
I guess I should hook into the Umbraco source and go through with debug to find out really what is applying that change...
Thanks for the help, should the TidyEditorContent be doing the trick for me?
Ok so I'm still swinging at this issue. Here's my setup. My document type has an RTE field. I display it through this template and macro:
But the problem actually occurs right away on the back office side (then also in front end). When I insert the pinterest code in the RTE I see the image correctly, just saving that node then will cause the bug.
Honestly, I'm surprised no one else has had this issue? There must something I'm missing and or doing wrong...
I'll try some more stuff next week and post this to twitter to get more guns on the issue.
EDIT: Ok editing posts completely destroys them lol...
Thanks!
I have found in "tinyMCEImageHelper.cs", the method "private static string StripSrc(string cleanTag, Hashtable ht)" at line #121 is the "culprit.
Following the yellow brick road leads me to this function, so the solution might be anywhere along the way.
So! I founda workaround, just adding
rel='popo'
to the img tag of the pinterest embed code, avoids that src manipulation.
It's really just a workaround and not a solution though, but the long term fix would require code change in Umbraco source.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.