Step 4 - Fix Errors

When things go wrong, error messages are your best friends.

The Python syntax is super easy to read and follow. Pelican is also very simple and ideal for you as an introduction to programming. This tutorial will help you set up a blog, a website or both depending on what need is. And host it on GitHub for the world to see.

In step three, you saw the following two error messages.

  • WARNING Watched path does not exist: /Users/yourname/Desktop/website/content/images
  • WARNING Unable to find `/favicon.ico` or variations:

Error 1: Add the images folder

  1. Make sure you are in the root folder by typing ls. If you need to move around, cd <foldername> in and cd .. out of folders till you are there.
  2. Type cd content, to move into the content folder and mkdir image to make the missing image folder.
  3. That is it. You will be using the image folder for images you will add in the next steps.

Error 2: What is a favicon

A favicon is that little icon that is on the tabs in your browser, like in the image.

favicon image

Make a favicon

Some applications can save an image as a .ico. If you don't have such an application that are webistes that will do the job for you.

The page I used is https://www.icoconverter.com/. As you can see from the image it is limited what you can see, so keep it simple.

Make sure the favicon is saved as favicon.ico.

If you are following along, you can download the favicon here.

Add new folder

In terminal, navigate to the content folder and mkdir extra

Add Lines to pelicanconf.py

Open the pelicanconf.py file and add the following lines at the bottom of the file.

The lines are telling pelican that there is a new folder to hold static files. The folder is called extra, because it'll hold different extra files and the only thing they have in common is that they are different.

STATIC_PATHS = [
    'images',
    'extra',  # this is the folder we'll add
]
EXTRA_PATH_METADATA = {
    'extra/favicon.ico': {'path': 'favicon.ico'},  # this is the direction for Pelican to find the favicon.
}

Add the favicon

Drag and drop your favicon file into the extra folder.

Check out your work

  1. make html and make serve
  2. Your page may look something like this. Website with favicon

<< See step 3 | See step 5 >>

COMMENTS

helpful links