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

Img on footer shows only on home

Solved by pamtbaau View solution

Started by JMM 6 years ago · 5 replies · 479 views
6 years ago

I have 2 img that I want to be shown always, because there are links to important pages. So I decided to try them on footer.
After edit the footer file (/user/themes/photographer/templates/partials/footer.html.twig) I reload the home page and the img are there with links working.

The problem showns when changing to any other page, the img stop working and the links are edited to somethgin like this. EG. The original link is /publicaciones/ANDURINA%20ENERO%202020.pdf, and after changing page it is like this: /es/festejos/galeria/2014/es/home/instalaciones/salones

I don't understand why is changning and why the img are not working either.

Would apreciate your help. Thanks

the page I'm working is hosted in biogreen.mx

6 years ago

@mera.inventio, You haven't given much info describing relevant context...

Questions:

  • What changes did you make to '/themes/photographer/templates/partials/footer.html.twig' ?
  • How does the folder structure look like of the two pages you are watching?
  • Where have you stored your images?

Tip:

  • You might condider using an inherited theme. If you do not use an inherited theme, an update of Photographer theme will override your changes.
last edited 02/03/20 by pamtbaau
6 years ago

Hi, thank u for your time.

this is the code I have in ‘/themes/photographer/templates/partials/footer.html.twig’:

Brackets_T4qOpSiY4U|690x392

And about inherited theme I do use one.

Hope u can help me with this info. This text will be blurred

6 years ago Solution

@mera.inventio, You are using relative urls for your images and anchors (<a>)

This means that the urls in href and src are prepended with url of the current page.

Eg.

If you use urls starting with a '/' (e.g. '/images/0/pie1.jpg'), the resulting urls will have a url prepended with the root of the site. Now the urls to the images will be the same on every page.

You might want to take a look at Grav's documentation on the use of images.

6 years ago

Thank U so much, this explanation is gold. Every day is something new to find!

6 years ago

@mera.inventio, The 'src' of the images seem to be fixed, but the 'href' of the surrounding <a> have not been fixed... Yet...

Suggested topics

Topic Participants Replies Views Activity
Support · by Water Science, 3 weeks ago
11 152 1 hour ago
Support · by Duc , 17 hours ago
1 42 17 hours ago
Support · by Thomas, 1 week ago
3 115 1 day ago
Support · by Anna, 4 days ago
2 105 2 days ago
Support · by Justin Young, 2 days ago
1 82 2 days ago