beans_remove_action – versus schema markup & validation

I could ne very wrong here, but bear with me

Using this

// Remove the post title.
beans_remove_action( 'beans_post_title' );

To remove a page title, to facilitate a bit of human seo, there appears to be a bit of a problem. Namely, it removes it πŸ˜› Might just be me, I'm used to using a plugin to hide the title, not removing it.

But there is an interesting consequence: it has a schema validation effect, a negative one actually.

When using such functions, it results in schema markup also not being present. To give an example, the headline changes from the actual title to the url of the site. And that, is not without drastic impact for page weight.

Similarly, it's also possible to accidentally @id from CreativeWork, strip headline, forget imageObject width/height, and so forth. It may seem trivial, it is anything but.

So either I'm doing something wrong, overlooking something - or not.

// Remove the post title.
beans_remove_action( 'beans_post_title' );

Strips the CreativeWork - Headline

Also, for some strange reason, this gives CreativeWork an @id of

// Remove the site title tag.
beans_remove_action( 'beans_site_title_tag' );

No effect. Which is peculiar.

// Only apply ot the front page and blog index.
if ( !is_front_page() && !is_home() ) {
    beans_remove_action( 'beans_post_image' );    

Strips the ImageObject from CreativeWork. Not as I had expected, namely PrimaryImageOfPage from Webpage. It seems the featured image for post/page is not used for that? Is there a particular reason for this?

Anyhow, this did make me think about something else. How feasible is it for beans to process images on post content as ImageObject for CreativeWork (as per schema guidelines) and use the featured image for WebPage?

One other thought, is there a way to use beans to simply hide the actual element, rather than remove it? While that might not be elegant, it does solve the penalty issue resulting from using the remove_action here and getting the page processed by Google. Don't get me wrong, using strictly only schema markup the penalty isn't that bad, but with a site that also uses json-ld (for example knowledgegraph, data relations, isic v4, Organisation or LocalBusiness - the latter in the current absence of supporting schema markup for that one) it gets nasty.

By the way, that @id for CreativeWork is bugging me. I've ran a DB search for it even, thinking I had somehow managed to insert that in it, but I can't find it. I find no reference to it within the child theme functions, nor anywhere else. Am I going mad?

Hey J.C.

It is entirely up to you to keep your HTML and schema semantic when modifying your theme. As mentionned in other post, Beans gives you full control over everything and allow you to build advanced professional websites. As a webmaster, it is up to you to follow good practices.

If you are looking to hide stuff, you can eighter use CSS or add the uk-hidden class to the markup you intend to hide. For instance you could hide the post title by adding the snippet below in your child theme functions.php (I don't advise to do so as it is considered as Black SEO):

beans_add_attribute( 'beans_post_title', 'class', 'uk-hidden' );

I am not sure I understand what you mean about and "@id for CreativeWork".

Hope that helps,

Yeah, the black seo bit is why I was trying to avoid hiding things, and exploring remove them πŸ˜›

I do think that beans is in a position to provide a foundation for a professional approach, providing schema semantic structure. Which can then be built upon for informational elements.

I may need to take the CSS road though, because straight up remove_actions do cause changes in markup and thus in how the data structure is processed.

And nope, I don't get the either. Still no clue where it is coming from. At least not yet!

Removing elements on the page such as H1 is probably not a great idea and I am not sure why you would want to do that. If you do so, keep in mind that you can also adjust your schema very easily using the beans_add_attribute() function.


Yeah, beans_add_attribute is something which probably should have been pointed out in big capital letters to someone like me πŸ˜›

There can be design reasons for removing or altering regular structure elements, it's always a very tricky thing, but at least if I understand things fully beans lets you - in a nutshell - "take away" one lego block, but allow you to have another show its colour. Without redesigning everything around it.

I think tomorrow I'm going to set aside some time for doing some testing with this πŸ™‚

Write a reply

Login or register to write a reply, it's free!