Step 3 - Add the First Page

Step three, creating the first page of your site. Most websites need pages like an about page or author bios. Information on these pages rarely change.

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 the terminal, reorient yourself by typing ls, and make sure you are in your root folder, cd in and cd .. out of folders until you see

ls
content     pelicanconf.py  tasks.py
output      publishconf.py

Creating the first page

  1. Type cd content (you can type con and this the tab key, it should finish the word content and you can then just hit return)
  2. Type mkdir pages and then cd pages.
  3. Type touch about.md (or whatever page you planned on adding, the important part is the .md)
  4. In Idle, Visual Studio Code or the IDE you installed in last step, open the content folder and then the Pages folder. Double-click on the file you just made.
  5. Type
Title: About

I love yogurt!

This page is a tribute to this ancient food.

Yogurt has ancient roots. Its first known
appearance was during the Neolithic period
(around 5000 BC) in Mesopotamia, when
milk-producing animals were first domesticated.

It has been found throughout Asia, Europe, and
the Middle East.

That makes yogurt well over 7,000 years old!

and hit save.

Make the HTML files

  1. Back in terminal make sure you cd .. out to the root folder and type make html. you should see
1   make html
2   "pelican" "/Users/yourname/Desktop/website/content" -o "/Users/yourname/Desktop/website/output" -s "/Users/yourname/Desktop/website/pelicanconf.py"
3   [21:13:48] WARNING  Watched path does not exist:                       log.py:91
4                    /Users/yourname/Desktop/website/content/images
5   Done: Processed 0 articles, 0 drafts, 0 hidden articles, 1 page, 0 hidden pages
6   and 0 draft pages in 0.49 seconds.

In line 3 you are warned that a path doesn't exsist. In line 4 you can see what path it is. The program is looking for an image folder Line 5-6 shows what html files where made 1 page in 0.49 seconds -- times may vary.

Serve the HTML files

  1. Still in terminal type make serve
1   $ make serve
2   "pelican" -l "/Users/yourname/Desktop/website/content" -o "/Users/yourname/Desktop/website/output" -s "/Users/yourname/Desktop/website/pelicanconf.py"
3   Serving site at: http://127.0.0.1:8000 - Tap CTRL-C to stop

In line 3, serving site, has nothing to do with yogurt. It has to do with how you'll be able to see your website in your browser.

Also in line 3, it says to hit ctrl+c to stop

View your new page

  1. Copy and paste http://127.0.0.1:8000 into your browser and hit reply
  2. You should now see

about page

See your moves in the terminal

When you click the different link in your website, your moves are logged. Pull up the terminal and you may see something like

1   Serving site at: http://127.0.0.1:8000 - Tap CTRL-C to stop
2   [22:16:54] INFO     "GET /pages/about.html HTTP/1.1" 200 -         server.py:121
3   [22:16:55] WARNING  Unable to find `/favicon.ico` or variations:       log.py:91
4                    /favicon.ico.html
5                    /favicon.ico/index.html
6                    /favicon.ico
7   ^C[22:27:56] WARNING  Keyboard interrupt received. Exiting.

In line 3, you see another error, that pelican is unable to find

In line 7, you can see the program stopped running with ctrl+c

Make it stick

Take some time to recognize the different parts of the website and where you would change them.

Also recognize the two headers for links and social and (again) think about what links you'd want there.

<< See step 2 | See step 4 >>

COMMENTS

helpful links