infinitered / ir-docs

Omnibus Documentation for Infinite Red Opensource
18 stars 5 forks source link

Add support for images -- logo/thumbnail for cards on home page. Banner for intro to docs. #30

Open trevor-coleman opened 6 months ago

trevor-coleman commented 6 months ago

Summary

Things to decide

Technical Implementation

  1. projects place their images in their static folder. These will be copied into ~/static/<project-name>

    ~
    ├── src
    │   └── ...
    └── docs
        └── static
            ├── img
            │   ├── project-logo.png
            │   ├── project-banner@2x.jpg
            │   └── ...
            └── ...
  2. the path of the image file is added as a prop to customProps in the _category_.json

    // ~/docs/_category_.json (in project)
    
    {
      "customProps": {
        "card": "img/project-logo.png"
        "banner": "img/project-banner@2x.jpg"
        // ...
      }
    // ...
    }
  3. the custom-homepage-plugin (A.K.A. /plugins/homepage-items-plugin.js😬) reads the paths fromcategory.jsonand adapts them to their-docs` directory structure.

    
     'img/project-logo.png' => `/${projectName}/img/project-logo.png`
  4. Components consume this via the docusaurus context.