Images are available in the GitHub repository but not displayed in Netlify deploying

#1

Hi!
I’m trying to deploying a static site using an Hugo Theme through GitHub and Netlify, but i do not know why the images aren’t displayed.

In a local environment there is not this problem.

Tks!

Obs.: I am using universal hugo theme

0 Likes

#2

If you open DevTools you’ll see some errors, that is the first hint

Then if I inspect one of your broken images, for example this one

<img src="http://aspartners.com.br~/static/img/as_partners.png" alt=" soon" class="hidden-xs hidden-sm">

I notice you’re including static in the img src path. You need to remove that

0 Likes

#3

Hi @zwbetz! Tks for your support!

I do not have a large experience with blogdown and this is my first experience with this static site generator.

I have tried this in a complete new static site using the function: blogdown::serve_site and I realized the same problem, during the local serving there is not any problem (display all the images), when I tried to deply in Netlify I’ve lost the images. I do not know how I could solve this.

Best,

Andre

0 Likes

#4

Since your question is more blogdown related (which I have no experience with, and is off topic for this forum) I’d recommend posting it to the R Studio forums

2 Likes

#5

A wild guess at part of the problem, since I don’t know blogdown either: Looking at your site I see the broken post images, so if I then look at the content files, I see something like:

---
banner: img/banners/banner-5.jpg
categories:
- lorem
date: "2015-10-10T13:07:31+02:00"
tags:
- ipsum
title: Migrate from Jekyll
draft: true
---
...

That img path is assuming relativity from the location of the post, but, the images are actually in /static/img/... so, you need to add a leading slash in the frontmatter.

---
banner: /img/banners/banner-5.jpg
categories:...
1 Like

#6

Unfortunately @RickCogley, it didn´t work…tks for help!

0 Likes

#7

The ~ in the url is wrong. Search for it, take it out.
Seconly as mentioned before: /static/ is most probably too not part of the url as all static items are copied into the root directory on build.

0 Likes

#8

Currently there’s some problems as there’s no / between the end of your domain name as the folder your assets are located.

I think you need to have a trailing / in your baseURL setting. So change https://github.com/andresalerno/hugo-site-v1/blob/master/config.toml#L1 to read baseURL = "http://aspartners.com.br/"

0 Likes