Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pelican theme for book

Tags:

pelican

I'm trying to convert a CMS-based page to Pelican. My page is about a technical topic in the form of a book (think for example of a tutorial / book about HTML). It seems all static site generators focus on blogs. Therefore, most themes I found just do some kind of blog layout.

Can anyone please point me to a theme more suitable for a book with chapters and sections? Ideally, I like to see a content structure in some kind of tree in a sidebar. Also, I'm interested how to link certain pages so that the reader can go from section to section.

like image 561
Sebi Avatar asked Nov 11 '22 01:11

Sebi


1 Answers

I'd recommend the "Elegant" theme, it has the flexibility you're looking for (their homepage has a good example of the sidebar feature you're mentioning).

As far as how you'd structure your Pelican site, you'll probably want to ignore the blog functionality of Pelican entirely, and create your book content as a bunch of static pages. If all your pages are markdown content, you can do something like this in your pelican site directory:

pelicanconf.py
content/
    i_am_a_blog_post.md
    pages/
        book_index.md
        chapter1.md
        chapter2.md
        chapter3.md

Then (this is the key to being able to drop in links to various content in the book) you specify the output location of the files book_index.md, chapter1.md, etc., by using the save_as metatag. So for example, book_index.md would contain:

Title: Book Index
save_as: book_index/index.html

Here is the index for my book:

* [Chapter 1]({{ SITEURL }}/chapter1/)
* [Chapter 2]({{ SITEURL }}/chapter2/)
* [Chapter 3]({{ SITEURL }}/chapter3/)

and chapter1.md would contain save_as: chapter1/index.html, and so on and so on. Now, when you visit your Pelican site, you can add "book_index/" to the end of the URL, and it will automatically take you to your book index page - which, conveniently for you, can still be written in Markdown.

like image 183
charlesreid1 Avatar answered Jan 02 '23 00:01

charlesreid1