I want all books to share the same Huge site, I realize this would probably be easier to setup right with a Hugo setup for each book
I want to be able to publish chapters of a specific book in this kind of link structure
www.example.site/books/title-of-book/chapter-1/
www.example.site/books/title-of-book/ ← chapter 0 page, listing information, book cover, tags related to that book
www.example.site/books/ ← root of the Hugo public folder, I want to be able to list recent chapters from all books on the site here
I want an easy way for readers to be able to go to the next and previous chapters of a specific book title without these links needing to be able to set up manually
I want to be able to set a chapter 0 of a specific book title and have it link all chapters along with publish dates, preferably able to be setup in an automated way
Has anyone used Hugo to do something like this before? Any suggestions on how to do the various parts the right way would be helpful.
I’m using this theme for this project. I don’t know of one more suitable for what I’m trying to do.
One of the problems I’m facing is that if I have multiple branch bundle (what I’m trying to use to organize books) only the posts of a single one shows up on the main page.
Using multiple branches other than posts also seems to break part of tags. The tag page populates, but when you click a tag for something in another branch bundle no posts/chapters which have that tag show up.
I’ll use this thread to document my struggles with trying to get this all to work.
Use one subfolder in your content directory per book. This is called a section. Add _index.md for the main page of the book and add chapter-1.md, chapter2-md, etc. or whatever name you wish as subchapters in the same folder.
Then either use one design for all (layouts/_default/single.html, layouts/_default/list.html for the _index.md) or add one design per section (with _default as fallback) in layouts/sectionname/(index|list).html
Add two booka content wise, then see if it works. THEN start thinking about the design. IN such a project I would always start with a clear content structure so you won’t have to restart when you find out your content is unusable structured.
I think I did this with the Branch Bundle? Or maybe I don’t understand the difference yet. The pages show as expected but two things break in the theme I am using which I do want that being tags not fully working and the main page only listing one branch/section?
I’ll make a public repo of what I’m trying to do so it can be shared and be easier to see what’s wrong.
I have published an example repo here. I figure eventually someone else will want to do something similar so I’ll leave this up once it’s all working as desired.
The main issue right now from making this fresh is that only chapters from a single book show up in the front page. There are 2 books with 2 chapters in the sample.
/books/dracula/
/books/wuthering-heights/
But for me only Dracula shows up.
Would it be something to do with the theme or something else?
Thank you, putting that under params did help to make all chapters show up on the main page.
I did see this before and though it has the book title in its name it seems more suitable for documentation or perhaps a book published all at once.
A reason for the structure of what I’m working on is that single chapters are published over time following the webnovel pattern.
There are a few more issues related to this project so I won’t mark any solutions as I’d like this thread to not be locked until everything is working.
The next thing I wanted to be able to do is to selectively disable breadcrumbs on a page.
Turns out it is as simple as setting the front matter param on the page, I was overthinking it.
---
title: "About Book Project"
searchHidden: true
draft: false
ShowBreadCrumbs: false
---
This site is a book project.
Next is adjusting this which I feel like will be easy and hard for me.
Maybe swap the left/right of the “next page / previous page” widget so it’s more logical to reading a book, might be other moving parts related to that which are going to require special changes to work cleanly
A problem is I want to exclude sections not within the current section. Now that mainSections is defined, all of those sections show up in the next/previous buttons.
This is the template currently
{{- if .Site.Params.ShowPostNavLinks }}
{{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{- if and (gt (len $pages) 1) (in $pages . ) }}
<nav class="paginav">
{{- with $pages.Next . }}
<a class="prev" href="{{.Permalink}}">
<span class="title">« Previous Chapter</span>
<br>
<span>{{- .Name -}}</span>
</a>
{{- end}}
{{- with $pages.Prev . }}
<a class="next" href="{{.Permalink}}">
<span class="title">Next Chapter »</span>
<br>
<span>{{- .Name -}}</span>
</a>
{{- end}}
</nav>
{{- end }}
{{- end }}
I need to do a few things
Only include sections of the current page, not other sections
Reverse the chronological order of presenting sections, it currently presents a chapter 2 as being previous to a chapter 1
I’m not yet familiar enough with how to modify the shortcodes yet to do this.
When I do this I can’t include links by themselves I have to have some text first. I also can’t use : in the description, how do I use this / escape it?
You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project. Please make sure you have pushed your local changes.