This is an extension, a set of shortcodes and templates to the original PaperMod theme, with a page dedicated to listing the books with responsive UI.
GPL-3.0 License
This is an extension, a set of shortcodes and templates to the original PaperMod theme, with a page dedicated to listing the books I've read.
Desktop view | Mobile view |
---|---|
It requires original PaperMod theme, install it first.
Clone PaperMod-bookshelf repo to your project:
as submodule (recommended)
cd your-site-location
git submodule add --depth=1 https://github.com/tgagor/hugo-PaperMod-bookshelf.git themes/PaperMod-bookshelf
You might need to initialize any uninitialized submodules in the repository and then recursively update all submodules to their latest versions to make it fully available:
git submodule update --init --recursive
or by just cloning
cd your-site-location
git clone --depth=1 https://github.com/tgagor/hugo-PaperMod-bookshelf.git themes/PaperMod-bookshelf
theme:
- PaperMod
- PaperMod-bookshelf
Original theme should be first, followed up by extension.
content/bookshelf.md
with such content:---
title: My Bookshelf
layout: bookshelf
url: /bookshelf
---
hugo new -k book books/2024/my-first-book
/bookshelf
URL.Theme rely on posts in the content/books
directory, to keep them outside of the typical posts. You might prefer other location.
To add new book, just create a new blok post type of kind book
:
hugo new -k book books/2024/new-book
It will generate "a blog post" describing the book, with additional fields which are required to make the mechanism work. They are:
title: Book's title
sub_title: Book's sub title
date: Date when you read the book
book_authors:
- A list of
- All the authors
categories: # used for finding the books among other posts
- Book
tags: # categories of books, use/extend as you want
- Biography
- Business
- Fantasy
- Finance
- Graphic Novel
- Leadership
- Management
- Mystery
- Politics
- Pop-sci
- Psychology
- Security
- Sci-fi
- Science
- Sociology
- Technology
- Trading
book_rating: 5 # your raging 1-5 stars
Archetype adds a shortcode book
call, which I preferred over typical book cover. It add's a nice header with book's cover and can provide links to few websites (reviews, affiliate links, whatever).
Rest is up to you. You can write a review or whatever π
Full structure of blog should look more or less like below:
$ tree your-site-location
.
βββ archetypes/
β βββ book/
β β βββ images/
β β βββ index.md
βββ assets/css/extended/
βββ content/
β βββ posts/
β β βββ your-posts-here
β βββ books/
β β βββ 2024/
β β | βββ my-first-book/
β βββ bookshelf.md
β βββ .../
βββ themes/
β βββ PaperMod/
β βββ PaperMod-bookshelf/
βββ config.yaml
βββ ...
If you're unable to get it working, check exampleSite
directory.
Configuration related to the cover in the original theme might impact how books are presented. My config looks like that:
params:
cover:
responsiveImages: true
hidden: false # hide everywhere but not in structured data
hiddenInList: false # hide on list pages and home
If you use hiddenInSingle: false
, then book posts would always show a huge cover image as a cover. I didn't like it. It's best to leave this setting not configured.
Then to hide the covers for books I hide them every time by:
cover:
hidden: true
That's my preference, feel free to play settings according to your needs.