There is a Question below. I am asking for help from the community. Read on…
Regarding the subject line, and the earlier forum topic
Post 6 on that topic seems incomplete (or their code didn’t post as intended) as the Before and After code are the same.
I was able to get a logo on my site by editing base.html.twig as follows
BEFORE
<div class="logo"> <h3><a href="{{ base_url_absolute }}">{{ config.site.title }}</a></h3> {% block social %} {% include 'partials/social.html.twig' %} {% endblock %} </div>``
AFTER
<div class="logo"> <a href="{{ base_url_absolute }}"><img src="{{ url('user://pages/images/my-clients-logo.png')|default('') }}" alt="{{ config.site.title }}" /></a> {% block social %} {% include 'partials/social.html.twig' %} {% endblock %} </div>
It is working, showing a logo and pulling in site.title as the alt text. I would like to replace the hard coded path to the logo with site.logo path from site.yaml but have been unable to get the syntax right to do this. I’m new to all this. Neither of the following works.
… img src=“{{ page.media(‘{{ config.site.logo }}’) }}” alt=“{{ config.site.title }}” /…
… img src=“{{ page.media[config.site.logo] }}” alt=“{{ config.site.title }}” /…
Can anyone help correct that?
I also edited site.yaml to include
logo:
_ /user/pages/images/my-clients-logo-file.png_