Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Add logo image

Started by Muut Archive 9 years ago · 6 replies · 2520 views
9 years ago

Hello,
i'm adding a logo image here:

TXT
/user/images/logo-image.png

In base/html.twig adding this:
--- html
<a href="{{ base_url == '' ? '/' : base_url }}"><img src="{{ base_url_relative }}/user/images/logo-reisgierig.png"></a>

TXT

In the settings activate *nl* and *en* languages for translate the variables. The theme is *Animatter*

The problem is that the logo doesn't load. If i looking in the code there is adding automattically *nl*:
--- html
<img src="/nl/user/images/logo-reisgierig.png">

Where can i putting best the logo? Is it better in themes dir? How can i solve this that the logo shows without problem?

This is the website: https://reisgierig.be/

PS: This is not a multilanguage website. It is for one language nl

9 years ago

base_url contains the language on multilanguage sites.

Try <img src="{{ url('page://images/favicon.png') }}"> instead.

9 years ago

Hi flaviocopes,

TWIG
<img src="{{ url('page://images/favicon.png') }}">

doens't work.

But i placed the logo.png in ../themes/animatter/images/logo.png

After that adding this code:

TWIG
<img src="{{ url('theme://images/logo.png') }}">

That works!

9 years ago

What about making that logo responsive When scrolling the page and also fitting to the general size of the navbar?

9 years ago

That would be good. Do you have a solution howto do that?

9 years ago

Late to the party but the following should work when putting images in user/images

<a href="{{ url }}/user/images/logo.png"><img src="{{ url('theme://images/logo.png') }}"></a>

9 years ago

I just figured out I was still pointing the last example towards the theme/images folder and not the user/images folder. The following should now work.

One issue though, how dow you hide user in the url so it just shows domain.com/images/tom.png and not domain.com/user/images/tom.png

TWIG

        <a href="{{ url('user://images/tom.png') }}"><img src="{{ url('user://images/tom.png') }}"></a> <br>

        <!-- The following line displays images when placed in the folder user/images -->
        <a href="{{ url }}/user/images/tom.png"><img src="{{ url('user://images/tom.png') }}"></a> <br>

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1297 9 years ago
Archive · by Muut Archive, 9 years ago
2 894 9 years ago
Archive · by Muut Archive, 9 years ago
2 4024 9 years ago
Archive · by Muut Archive, 9 years ago
1 2899 9 years ago
Archive · by Muut Archive, 9 years ago
3 1082 9 years ago