Giter Club home page Giter Club logo

hugo-papermod-bookshelf's Introduction

PaperMod-bookshelf

build GitHub GitHub Release Date

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.

Live demo on my blog.

Desktop view Mobile view
Desktop view Mobile view

Installation

  1. It requires original PaperMod theme, install it first.

  2. 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
  1. Update blog config:
theme:
  - PaperMod
  - PaperMod-bookshelf

Original theme should be first, followed up by extension.

  1. Create a page where books will be listed, for example content/bookshelf.md with such content:
---
title: My Bookshelf
layout: bookshelf
url: /bookshelf
---
  1. Add first book, by calling:
hugo new -k book books/2024/my-first-book
  1. Run your page and check /bookshelf URL.

Adding books

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 ๐Ÿ˜‰

Example configuration

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.

Considerations on configuration

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.

hugo-papermod-bookshelf's People

Contributors

tgagor avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.