|
Joined: Jun 2008
Posts: 92 Likes: 1
Journeyman
|
Journeyman
Joined: Jun 2008
Posts: 92 Likes: 1 |
When a post is posted in HTML mode, the open-graph "description" header displays code in <script> tags. Before populating the og:description header., it may be good to: 1. Convert the post to raw text (stripping out all HTML). 2. Remove all linefeeds and carriage-returns. 3. Remove all duplicate spaces. Here's a real-life example. This is what I'm seeing in the header of one of my posts. This is posted in HTML mode and contains a script tag at the beginning to pull in some boilerplate text for the post. This ends up throwing some garbage into the <head> of the HTML page: <meta property="og:description" content="document.write(GetPostTemplate_LinkToThis("http://urlbam.com/ha/2zz","http://urlbam.com/ha/1zz","Amalgam Fillings &amp; Mercury Poisoning"));
The Smoking Tooth Video
Did you know that mercury vapor offgasses from amalgam (&quot;silver&quot;..."> Hope this is helpful.
Last edited by mmem700; 02/01/2019 3:10 PM.
Today they call you "crazy". Tomorrow they call you "ahead of your time".
|
|
|
|
Joined: Jun 2006
Posts: 16,299 Likes: 116
|
Joined: Jun 2006
Posts: 16,299 Likes: 116 |
Well, PHP Strip Tags is whats eliminating the HTML tags (as it should) in the description, but is left with the script content as post content (as the content is not comprised of HTML tags); are you allowing users to post HTML code? It's extremely dangerous if so... The BBCode system generally has most tags that users could need to make posts (most formatting options) and you could make a custom bbcode (in the editor in the Control Panel) if you needed to extend the system (though, again, I woudln't allow users to post any JavaScript).
|
|
|
|
Joined: Jun 2008
Posts: 92 Likes: 1
Journeyman
|
Journeyman
Joined: Jun 2008
Posts: 92 Likes: 1 |
Thanks for responding.
Actually, we only allow admins to post HTML.
The Post-As-HTML feature is very powerful and very useful for us. I really appreciate having it available.
Just wondering if CRs, LFs and <script> tags should be stripped (only when posting in HTML mode) before placing it in the og:description header.
Today they call you "crazy". Tomorrow they call you "ahead of your time".
|
|
|
|
Joined: Jun 2006
Posts: 16,299 Likes: 116
|
Joined: Jun 2006
Posts: 16,299 Likes: 116 |
Just wondering if CRs, LFs and <script> tags should be stripped (only when posting in HTML mode) before placing it in the og:description header. Negative, the way things work for all posts is to run things through the filters, the easiest of which is strip_tags (well, a custom form of it, see the strip_tags_special function in libs/bbcode.inc.php), which is removing tags as its supposed to, but is being left with the additional content within the tags in your post as post data (as the stripped tags are being removed as they are supposed to be). HTML posts and HTML with UBBCode are parsed differently, BBCode posts will not filter CR and LFs. If linking to offsite JavaScript is a requirement, you should look into custom bbcode tags; your special use of the HTML mode (to include JavaScript) is really out of the scope for what these default tags were written for (which was formatting), so if you want to keep the stock code in place and not use custom bbcode tags (with its default behavior) I'd recommend just leaving the og:description tag commented out.
|
|
|
|
Joined: Jun 2008
Posts: 92 Likes: 1
Journeyman
|
Journeyman
Joined: Jun 2008
Posts: 92 Likes: 1 |
I hear what you're saying and thanks for the info.
I can just comment out the code for now, but please don't ever remove the ability to make HTML posts. We rely heavily on this and it works well for us.
Thanks.
Today they call you "crazy". Tomorrow they call you "ahead of your time".
|
|
|
|
Joined: Jun 2006
Posts: 16,299 Likes: 116
|
Joined: Jun 2006
Posts: 16,299 Likes: 116 |
I can just comment out the code for now, but please don't ever remove the ability to make HTML posts. We rely heavily on this and it works well for us. No plans to, I create templates like this for clients.
|
|
|
|
Joined: Jun 2008
Posts: 92 Likes: 1
Journeyman
|
Journeyman
Joined: Jun 2008
Posts: 92 Likes: 1 |
Very nice.
So by "template" you mean block of HTML that you use over and over... is that right?
Is there some feature in UBBT that helps with this that I may be missing?
Just thought I'd ask in case this is something that we could be using.
Thanks.
Today they call you "crazy". Tomorrow they call you "ahead of your time".
|
|
|
|
Joined: Jun 2006
Posts: 16,299 Likes: 116
|
Joined: Jun 2006
Posts: 16,299 Likes: 116 |
You could insert a default og:image tag in the header includes (CP -> Display -> Gerneral -> HTML Includes).
|
|
|
|
Joined: Apr 2004
Posts: 1,945 Likes: 145
|
Joined: Apr 2004
Posts: 1,945 Likes: 145 |
good suggestion, giz
|
|
|
|
Joined: Jun 2008
Posts: 92 Likes: 1
Journeyman
|
Journeyman
Joined: Jun 2008
Posts: 92 Likes: 1 |
You could insert a default og:image tag in the header includes (CP -> Display -> Gerneral -> HTML Includes). Yes, that's what I resorted to doing. thx
Today they call you "crazy". Tomorrow they call you "ahead of your time".
|
|
|
Bots
by Outdoorking - 04/13/2024 5:08 PM
|
|
|
|
|
|
|
|