Vanilla-OS / Chronos

Chronos is a simple, fast and lightweight documentation server written in Go.
GNU General Public License v3.0
18 stars 4 forks source link

Support for stories #21

Closed mirkobrombin closed 2 months ago

mirkobrombin commented 7 months ago

A story in Chronos is a collection of articles that should be read in a specific order. The idea is to add a new key in the article header:

..
story: my-first-story
..

then adding a new stories.yml in each articles directory (for each language), with the following format:

- id: my-first-story
  name: My First Story
  description: See how cool is my first story
  chapters:
    - name: my-first-article-file-name
      order: 0
      showsInIndex: true
    - name: my-second-article-file-name
      order: 1
      showsInIndex: false

The showsInIndex key will be used by Chronos to avoid listing articles that must only show in the story.

Chronos then will use that to provide one new key in each article response:

 {
    "Story": {
        "Id": "my-first-story",
        "Name": "My FIrst Story",
        "Description": "See how cool is my first story",
        "Previous": "",
        "Next": "my-second-article-slug"
    }
}

the client can then use this information to manage navigation between story chapters.

There will be also a new :repoId:/stories endpoint to return all the stories in the collection.

kbdharun commented 7 months ago

LGTM, we could maybe show these stories separately in the frontend (related: https://github.com/Vanilla-OS/chronos-frontend/issues/35).

mirkobrombin commented 2 months ago

Actual implementation only requires the stories.yml file in the articles' root directory:

- id: testing
  name: My First Story
  description: See how cool is my first story

and add the story references in each article:

---
StoryId: testing
Previous: ""
Next: "test2"
Listed: true
Title: Test
Description: Test
PublicationDate: 2023-08-29
Authors:
  - Vanilla-OS
Tags:
  - test
---

test

the stories feature and all its values are optional and per repo.