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

Image instead of text as logo (Antimatter)?

Started by Muut Archive 11 years ago · 15 replies · 1707 views
11 years ago

Is there a way to use a image instead of the site-title as logo in Antimatter-theme?

11 years ago

Edit the templates/partials/base.html.twig file. That is where the text is being output for the logo, simply change it to an image.

11 years ago

I´m getting closer! :-)

Whilst this

<h3><a href="{{ base_url_relative}}"><img src="{{ base_url_relative }}/user/images/logo.png" /></a></h3>

is working fine, this

<h3><a href="{{ base_url_relative }}">{{ pages.find('/images').media['logo.jpg'].manpulations.html %}</a></h3>

gives me a twig syntax-error. I thought there was a } missing, but when I added it it does not work either.

<h3><a href="{{ base_url_relative }}">{{ pages.find('/images').media['logo.jpg'].manpulations.html %}}</a></h3>

Error

11 years ago

Please put your code between backticks (`) otherwise characters get stripped out. I can't really tell what your code is without it.

11 years ago

Sorry, so what you wrote in the post linked above

<h3><a href="{{ base_url_relative}}"><img src="{{ base_url_relative }}/user/images/logo.png" /></a></h3>

is working but not responsive. The second, which should be resonsive, gives the syntax-error:

<h3><a href="{{ base_url_relative }}">{{ pages.find('/images').media['logo.png'].manpulations.html %}</a></h3>

11 years ago

I added a screenshot on my last link named "error".

11 years ago

do you actually have the word manipulations in the output? that's not valid.

You could have none:

TWIG
<h3><a href="{{ base_url_relative }}">{{ pages.find('/images').media['logo.png'].html %}</a></h3>

or some valid manipulations such as:

TWIG
<h3><a href="{{ base_url_relative }}">{{ pages.find('/images').media['logo.png'].cropResize(300,300).html %}</a></h3>

These are documented in the media docs.

11 years ago

Doesn`t work, it gives me a "Unexpected "}" in "partials/base.html.twig" at line 44"

11 years ago

Oh typos on my part...

should be }} to close not %}. They need to match the opening tags.

11 years ago

Yeah! THIS worked! Thanks a lot! Even if I have to learn a lot, I love GRAV! :-)

11 years ago

One last thing, I`ve found out. With your last code provided, the link of the logo is always to the current page but not the home page. I guess the base_url_relative has something to do with, but when I change this to base_url == '' ? '/' : base_url it gives a error.

11 years ago

The Antimatter theme has:

TWIG
<a href="{{ base_url == '' ? '/' : base_url }}">...</a>
11 years ago

Thanks, worked. I use now the following code
<a href="{{ base_url == '' ? '/' : base_url }}"><img src="user/pages/images/logo.png" /></a>
and I`m happy with it.

9 years ago

This last code worked for me too. I had to resize the logo to 60pixels in height to fit in the heading.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1321 9 years ago
Archive · by Muut Archive, 9 years ago
2 916 9 years ago
Archive · by Muut Archive, 9 years ago
2 4047 9 years ago
Archive · by Muut Archive, 9 years ago
1 2921 9 years ago
Archive · by Muut Archive, 9 years ago
3 1105 9 years ago