This is how I’ve converted this website, which is written in Markdown using the Hugo framework, to an ebook with epub format, that I uploaded to https://leanpub.com/kaueswayoflife.
Customized the site to hide:
Customized the logic using a HUGO_BOOK
environment variable and a hide_from_book
page parameter:
{{- $isBook := getenv "HUGO_BOOK" -}}
{{- if not $isBook -}}
...
{{- end -}}
...
{{- if and $isBook .Params.hide_from_book -}}
{{- else -}}
...
{{- end -}}
Hiding certain pages with:
hide_from_book: true
Designed the cover on https://www.canva.com .
Generated with two terminals.
First terminal runs a local Hugo server setting the HUGO_BOOK
environment variable:
$ cd hugo
$ HUGO_BOOK=1 hugo server
Second terminal crawls the pages of the local Hugo server and converts them:
$ cd book
$ pandoc -o dist/book.epub \
--table-of-contents \
--epub-cover-image cover.png \
--epub-metadata meta.xml \
-f html \
http://localhost:1313/ \
$(lynx -dump -listonly \
http://localhost:1313/all/ \
| grep -oh 'http.*' \
| grep -v '\(.me/feed.xml\|/all/\)') \
http://localhost:1313/
Pages:
/all/
page;Using a simple metadata file:
<dc:title>Kaue's Way Of Life</dc:title>
<dc:language>en-US</dc:language>
Tested on https://play.google.com/books/uploads?type=ebooks .
Shared on https://leanpub.com/kaueswayoflife .