[fastpages] Images not displayed - Repo name inserted as baseurl [SOLVED]

Hi

I am not able to display images when writing files from notebooks, by the looks of it my repo name keeps getting inserted into the baseurl.

My blog is here: https://github.com/morganmcg1/ntentional

I have changed baseurl as instructed`, it as:

  • "" in _conifg.yml
  • and empty in _action_files/settings.ini

An image display example from a markdown post generated from a notebook shows that ntentional still gets added as the baseurl:

<p><img src="/ntentional/images/copied_from_nb/my_icons/fastai_logo.png" alt="image" title="RoBERTa"></p>

And when I open a post running locally the terminal displays:

[2020-04-29 06:22:52] ERROR /ntentional/images/copied_from_nb/my_icons/fastai_logo.png not found.

I think you could be overriding some files by commiting ALL the files to your repo. It looks like you have settings.ini as well as other notebooks in the root of your repo which leads me to believe you could be breakign something.

  • Rename your repository
  • Pull a fresh copy of the repo from fastpages, name it to match the old name
  • make the appropriate changes in settings.ini and _config.yaml
  • copy your notebooks over

let us know if that works. I cannot reproduce this error because we are doing the same thing for fastpages.fast.ai and this doesn’t break there so the problem lies somewhere in the config

I’m having the same issue, either I get the following error:

no such file or directory: /github/workspace/_notebooks/images/logo2.png.

Or when then the image is uploaded there are no errors but it does not display.

There is logo2.png in the images folder in _notebooks in the repo

I ended up resorting to using githubusercontent
![TEST](https://raw.githubusercontent.com/asvcode/Blogs/master/images/logo2.png) for the image to display

It’s really hard to debug this with the limited information provided

I wrote a checklist and a guide to help you help me How to troubleshoot fastpages

@amritv That is because you are not following the instructions in _config.yml

3. You must replace the parameter baseurl in _action_files/settings.ini with the same value as you set here but WITHOUT QUOTES.

###########################################################
#########  Special Instructions for baseurl ###############
#
#### Scenario One: If you do not have a Custom Domain #####
#    -  if you are not using a custom domain, the baseurl *must* be set to your repo name
#
####  Scenario Two: If you have a Custom Domain #####
# 1. If your domain does NOT have a subpath, this leave this value as ""
# 2. If your domain does have a subpath, you must preceed the value with a / and NOT have a / at the end.
#      For example:
#           "" is valid
#           "/blog"        is valid
#            "/blog/site/" is invalid  ( / at the end)
#            "/blog/site"  is valid
#            "blog/site"   is invalid  ( because doesn't begin with a /)
#
# 3. You must replace the parameter `baseurl` in _action_files/settings.ini with the same value as you set here but WITHOUT QUOTES.
#

You have decided to put something else in your settings.ini file so your images cannot be copied.

1 Like

@morgan you are not reading the instructions carefully. Please read the instructions again

Why are you setting baseurl to an empty string??? Your base url is /ntentional so it doesn’t make sense that you set it this way. Please read the instructions in _config.yml carefully

Thanks for reaching out @hamelsmu. I should have added additional info for better debugging. Originally I had used a different repo and then about a month ago changed it to another repo. I must have missed changing that setting because everything else worked fine (there were no images to display)

I however changed the name as you instructed.

I currently have baseurl in _config.yml set to:

`baseurl: “/Blogs”

Changed the value in settings.ini to:

baseurl = /Blogs

I am using ![Test](images/dicom_wf.PNG) to display the image locally which renders ok. but still get the same error:

I cloned a new copy of fastpages and tested on a new repo and it works fine so it must be something do with the renaming process. New Test Repo/

I will take this route and re-do the whole thing. Thanks again for your help

I suggest starting over again and copying your posts over. Something is wrong in your settings

1 Like

You also have to make sure you commit the file to the repo. Does that file exist in your repo at that location?

:scream: it works! thanks for all your help

Getting back after a few days AFK, thanks for looking at this @hamelsmu, I think your second comment here was looking at a fresh pull that I had half-started to set up but then stopped. My freshly created blog repo today is here: https://github.com/morganmcg1/ntentional and is being served at www.ntentional.com

I think I have started to track down the issue;

tl;dr

I think there is an issue in how the settings.ini file (in the root folder) is created when the blog is built locally when using a custom domain with no baseurl (i.e. wanting to serve the blog at www.ntentional.com and not www.ntentional.com/blog).

Direct upload on github.com works fine

If upload + commit a notebook to my _notebooks folder directly on github’s website, the images renders as expected on the blog:

notebook file, corresponding blog post

However, if I am running the blog locally and add/modify a notebook, the same notebook will have an issue with the filepath to the image when I try and view the blog locally. The local notebook -> markdown process adds the incorrect baseurl to the file path

[2020-05-05 05:23:27] ERROR /ntentional/images/copied_from_nb/my_icons/fastai_logo.png not found.

settings.ini issue?

The issue appears to be when the blog is built locally, the baseurl in the settings.ini file that is created in the ROOT folder is set to the repo name and NOT what is in _action_files/settings.ini.

I think this is why the baseurl used in the local notebook->markdown process then gets set incorrectly as it then takes baseurl from settings.ini and not _action_files/settings.ini

Two questions

  1. When writing a blog post via a notebook locally should I make sure to only commit the files in _notebooks and not the associated markdown files created in _posts?

  2. Is this expected behaviour when using a custom url and building the blog locally?

I really appreciate the help on this, its can’t be easy being a one-person support team!

Rebuild your Docker container with

make build

Yes, perfect that worked, thank you!!