![](https://beanscommunity.wpenginepowered.com/wp-content/uploads/beans/images/2a40abc955e1f5ea45b5ed8fc30014b3-87a1c39.jpg)
I'm using the following to enable a back to top method:
// Add Back to Top ID.
beans_add_attribute( 'beans_body', 'id', 'mk-top' );
In development mode, I noticed something interesting:
<body class="home page page-id-5 page-template-default uk-form no-js" itemscope="itemscope" itemtype="http://schema.org/WebPage" id="mk-top" data-markup-id="beans_body"><div class="tm-site" data-markup-id="beans_site"> <div class="tm-header-bar uk-block-muted">
As you can see, WebPage suddenly has a very strange @id. I also noticed there's a bunch of required elements missing, but that's another discussion. It's weird though, how little changes can have unintended consequences.
Tying a back-to-top function to - for example - beans_site also works, but has yet other consequences for schema parsing, notably adding the article_id to CreativeWork @id and removing everything from WebPage except for @type.
These unintended results do not invalidate the schema enabled data structure, they also do not throw up errors in testing tools, but they do deny the presence of schema + data structures getting valued for seo weight.
So how can I enable a functional back-to-top method, without getting in the way of schema?
![](https://beanscommunity.wpenginepowered.com/wp-content/uploads/beans/images/c70294be72623e3f8995ee4832f8d065-87a1c39.jpg)
You could simply prepend an anchor div
as such:
add_action( 'beans_body_prepend_markup', 'example_anchor' );
function example_anchor() {
?><div id="mk-top"></div><?php
}
Cheers,
![](https://beanscommunity.wpenginepowered.com/wp-content/uploads/beans/images/2a40abc955e1f5ea45b5ed8fc30014b3-87a1c39.jpg)
Yeah, I did try a custom anchor div, but that throws WPHeader somehow off track - it's up in smoke.
Incidentally, the very same result I get when adding a header bar when using prepend_markup (before_markup rearranges WebPage elements, also kills any SiteNavigation one might have added).
Somehow this seems to be a very sensitive thing to do, adding/inserting to beans_body.
I see on the beans website itself something similar. There WPHeader has no description as a logo is set for site branding. It's valid syntax, but invalid schema tree / data structure, hence nothing is processed for seo.
Example structure This is strictly for Blog / Post obviously, since a few months every type now needs to carry its own schema (post -> Blog, page -> Article, generic -> Webpage, function specific -> ContactPage, et cetera), but when I apply Beans to it I think it may only be possible to keep things compliant and functional as long as they are contained within the beans fragments as such. So no adding anything before a header, only inside the header, without rearranging things.
Maybe you can think of something else, but I can only see two approaches: first updating & completing schema structures, alternatively extending beans (wp) templates to contain their own data structures?
![](https://beanscommunity.wpenginepowered.com/wp-content/uploads/beans/images/c70294be72623e3f8995ee4832f8d065-87a1c39.jpg)
Hey J.C.
Depending on your markup structure and CSS (like if you added style for div
), adding a div
may disturb other elements. Make sure that your anchor is not floating or if it is the case, make just that the width is set to 100%. Feel free to post a link to your website if you want me to take a look.
Regarding the schema, I have already made a note to re-look at the all Beans schema and make some more solid testing.
Thanks,