Forum

Thread tagged as: Question, Blog

Making Social / Meta info easier to update for Blog posts

This is what I would like to do:

  • Move all of the Meta Data information from the Meta and Social tab into the main blog post editing tab.
  • Have all of the Facebook / Twitter social / open graph data automatically populated by the relevant info e.g. 'Social Title' would be the blog post title and 'Image when shared' would be the main image that goes with the blog post.

How would I go about doing these things? I think this makes it much easier for the editors of the website as the second tab is often forgotten about and some of it would be duplicate information from the first tab.

Thanks, Mike.

Mike Harrison

Mike Harrison 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

There isn't an option for that. We actually moved all that stuff out of the main form because people were complaining that it was too much information to collect at once and the form was too long.

Ah OK. That's a shame - I obviously think differently to everyone else then! Would be certainly be a nice option to have in terms of a feature suggestion. Especially the part about pre-filling social data with existing fields.

Drew McLellan

Drew McLellan 2638 points
Perch Support

The common fields should automatically pre-fill already.

Just checked again. The "Social title" pre-fills ok, but the "Social description" includes HTML tags which need to be deleted manually. The "Image when shared" doesn't use the main post image.

Also, when you click 'Save' on the first tab of editing a blog post it does not save the information that is prefilled in the second tab, so you end up having to hit Save in both tabs in order for everything to update.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Right - it doesn't copy the content, it pre-fills the edit form. You still need to save it.

As a post can have any fields you like (including things like and image or not) we can't automatically pre-fill everything.

Ok. What about the HTML tags? I've tried adding "striptags=true" to the "og-description" tag in post_meta.html but it does nothing. Is there another way of removing the HTML automatically in the Social description field?

Drew McLellan

Drew McLellan 2638 points
Perch Support

The syntax should be

striptags="true"

Drew McLellan said:

The syntax should be

striptags="true"

That's what I meant sorry. That doesn't work unfortunately.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Without your code I can only make guesses. Are you storing HTML? If you're encoding it then they won't be tags anymore and won't get stripped.

I'm pretty much using Perch Blog 'out-of-the-box' so to speak with the exception of using ckeditor instead of markitup in all cases:

// post.html
<div class="description e-content">
        <perch:blog id="postDescHTML" type="textarea" label="Post" order="2" editor="ckeditor" html="true" size="xxl autowidth" required="true" />
</div>
<perch:blog id="excerpt" type="textarea" label="Excerpt" html="true" order="3" editor="ckeditor" suppress="true" size="s" />
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, and where is the striptags attribute that isn't working?

// post_meta.html
<perch:blog id="og_description" label="Social description" type="textarea" striptags="true" size="s" escape="true" />
Drew McLellan

Drew McLellan 2638 points
Perch Support

That should work fine.

Nope, afraid not sorry! Seems to be a problem related to me using ckeditor and html.

If I use Markitup and markdown it works fine:

// post.html

<perch:blog id="excerpt" type="textarea" label="Excerpt" markdown="true" order="3" editor="markitup" suppress="true" size="s" />

The problem is, I want to use ckeditor as my client prefers a WYSIWYG editor.

Drew McLellan

Drew McLellan 2638 points
Perch Support

If you're using CKEditor for both, isn't CKEditor using the HTML it's given?

Yes but when you try sharing the blog post to Facebook you get "pSome content/p"

Drew McLellan

Drew McLellan 2638 points
Perch Support

It seems implausible that striptags isn't working. Are you sure you have the attribute in the correct template?

I have it in the post_meta.html template as shown above.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is that the template you're using to output the content to the page?

If that is what happens by default using

perch_blog_post_meta(perch_get('s'));"

then yes.