Use Hugo API to build a online book service

I want to use Hugo help me to build a online book service, which should have features like:

  1. Create book with name
  2. Create menu
  3. Create preface
  4. Create Chapter
  5. Create Section

Based on the Hugo domain knowledge discussed in this thread Difference between Page Bundles and Sections?.
The API provided by Hugo will looks like:

  1. Create book with name
    1. POST /site/name
    2. POST /site/page/home
  2. Create menu
    1. POST /site/page
  3. Create preface
    1. POST /site/page
  4. Create Chapter
    1. POST /site/page/section
  5. Create Section
    1. POST /site/page/section?parent

Any suggestion?

Hugo creates your website and then the website is static. You can’t let Hugo “create” content on your live site while it’s online somewhere. “Creating” is locally creating your MD file that Hugo then uses to render the page.

What you could do is use a web service like Strapi where your content lives. Then, create your content via “webhooks” and Javascript that talk to Strapi (or any comparable service) and let Hugo create the pages for existing content on update.

There might be other services than Strapi; that is just what comes to mind when I see your feature list.

You may also use Staticman to create POST requests which can be used to create markdown files for Hugo procesing.

Content Management Web Service → MD files → use Hugo to generate static website.

Thanks for suggestion. What I’m trying to do is to extend Hugo to other two steps:

Hugo online service powered by MD/Text editor online → generate Hugo project with content → publish Hugo Static Website.

Actually, Hugo is a really powerful content management system.

Take book service for example: we can use it to create a online book writing service and publish to public market automatically.

And there are so many possibilities for Hugo. I just want to start a POC for it.

I want to try this process by using Hugo ecosystems. So that I want to extend Hugo a little bit.

1 Like

Sounds great and looking forward to the first version of your work. :wave:

1 Like

Thanks.

Quick update for the API design:

  1. Create book with name
    1. POST /site/name
    2. POST /site/name/page/home
  2. Create menu
    1. POST /site/name/page
  3. Create preface
    1. POST /site/name/page
  4. Create Chapter
    1. POST /site/name/page/section/name
  5. Create Section
    1. POST /site/name/page/section/name/page | /site/name/page/section/name/subsection/subsectionname
  6. Generate Static Website
    1. POST /site/name/gss
      1. Website, home - index.html, 404.html
  7. Deploy Website
    1. POST /site/name/deploy

Any suggestion?