Active
Project:
RDF entity
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Apr 2021 at 12:24 UTC
Updated:
19 Apr 2021 at 12:26 UTC
Jump to comment: Most recent
The default template and preprocessing function causes the title of an RDF entity to malrender. The template (rdf-entity.html.twig) contains the following section to render the label:
<article{{ attributes }}>
{# ... #}
<h2{{ title_attributes }}>
<a href="{{ url }}" rel="bookmark">{{ label }}</a>
</h2>
{# ... #}
</article>
So we should expect the label to be rendered as follows:
<article role="article">
<h2>
<a href="/rdf-entity/my-entity" rel="bookmark">My label</a>
</h2>
<!-- ... -->
</article>
But instead, we get something like this which includes a whole bunch of unwanted field markup:
<article role="article" class="contextual-region">
<h2>
<a href="/rdf-entity/my-entity" rel="bookmark">
</a>
<div>
<a href="/rdf-entity/my-entity" rel="bookmark">
</a>
<a href="/rdf-entity/my-entity" hreflang="en">My label</a>
</div>
</h2>
</article>
Show an article as secondary content on a page, e.g. in a view.
In template_preprocess_rdf_entity(), output the label as a string and not as a rendered field.
The HTML output for the base template will render correct HTML for the label.
None.
None.
This workaround can be put in the theme file as a quick fix for the issue:
function mytheme_preprocess_rdf_entity(&$variables) {
$variables['label'] = $variables['rdf_entity']->label();
}
Comments
Comment #2
pfrenssen