I want to style a node's author data and tags slightly differently to the Bartik theme in Drupal 9.3. That is, rather than:
Submitted by user1 on Mon, 1/1/70
Tags
foo
bar
I'd like to have:
Submitted by user1 at Mon, 1/1/70 on foo | bar
So far, I have created a subtheme tweak
with the following definition in tweak.info.yml
:
name: Tweak
type: theme
description: This is a sub-theme of Bartik
core_version_requirement: ^8 || ^9
base theme: bartik
version: '9.3.0'
regions:
header: Header
primary_menu: 'Primary menu'
...
I have copied the following templates into my subtheme and modified them:
templates/node.html.twig
templates/field--taxonomy-vocabulary-1.html.twig
I have enabled my subtheme and I can confirm that the overriding templates are being executed. That is, I get the following:
Submitted by user1 at Mon, 1/1/70
on foo | bar
Unfortunately, there is a lot of HTML in between the two lines, ie.
<span>
Submitted by
<span class="field field--name-uid field--type-entity-reference field--label-hidden">
<span lang="" about="/user/2" typeof="schema:Person" property="schema:name" datatype="">user1</span>
</span>
at
<span class="field field--name-created field--type-created field--label-hidden">Mon, 1/1/70 - 16:29</span>
</span>
</div>
</header>
<div class="node__content clearfix">
<div class="field field--name-taxonomy-vocabulary-1 field--type-entity-reference field--label-above clearfix">
on
<a href="/taxonomy/term/7" hreflang="en">foo</a>
| <a href="/taxonomy/term/2" hreflang="en">bar</a>
</div>
What I'd like to have is the output from field--taxonomy-vocabulary-1.html.twig
within the same <div>
as the Submitted by ...
content. However, I cannot see how to do that. Can anyone give me some pointers?