How to add books? There are many chapters in a book, arranged in a specific order

I’m a programmer and novelist. I want to know how I should add a book?

My ideal routing format is:

https://xxxx.com/novel/${novel} → novel introduction, novel chapter catalogue (sorted)
https://xxxx.com/novel/${novel}/${chapter} → chapter details

Can I add it to one of the places?


Thank you very much for your help!

Welcome to to community, @XYH.

This thread may provide some ideas or insight.

This is a good use case for custom routing.

In routes.yaml, you could do something like this, where the book-title would be whatever novels you’re using. You’d need to add an entry for every book.

collections:
  /novel/book-title/:
    permalink: /novel/book-title/{slug}
    filter: tag:book-title
  /novel/book-title2/:
    permalink: /novel/book-title2/{slug}
    filter: tag:book-title2

Find more resources on custom routing:

Another way (without downloading and uploading the routes.yml over and over again), and/or if you want to manage your ordering strictly in the admin panel, you can re-purpose the Date/Time setting for each post/page. If each post/page has its own Day or Hour or Minute assigned to it, then you can still insert and remove content without changing the settings for every other post.

Until some clever theme builder provides a custom theme setting for this (I vote for a modal popup containing draggable, nestable post ordering per Tag :-) …

This blessed soul took a crack at it (I installed it on one of my sites and it does the job too). It also has some handy built in formatting controls for the reader (changing text size and style, plus dark/light/sepia modes.) It’s also super minimal and displays well on mobile:

(You have to right-click and translate the Github page which is in Chinese)

You can see where I have it running (at least for a short time while I test and tinker with it):

Front Page of Site…

Individual Book…

I had another thought about this…

@themeix has a new theme wherein you can structure and sequence posts using tags…

And while @themeix has purposed the theme’s tags structure for Courses and Lessons, it seems to me simple enough to adapt it for Books and Chapters.

@themeix do you have any thoughts about this?

Yes, You are correct… Its possible…