Hugo Swagger UI Module

Hugo Swagger UI Module which ships with a shortcode and standalone preset layout.

Donate

Become a backer or sponsor to support our work.

Sponsors
Module
github.com/hugomods/swagger-ui
GitHub Stars Used By Used By Used By Used By

Installation

Import Module

1module:
2  imports:
3    - path: github.com/hugomods/swagger-ui

Import CSS and JavaScript

1<head>
2  ...
3  {{ partialCached "hugomods/swagger-ui/assets/css" . }}
4  {{ partialCached "hugomods/swagger-ui/assets/js" . }}
5  ...
6</head>

Standalone Preset

To use a standalone preset, you’ll need to specify the layout as swagger-ui and the swagger_ui.url.

1---
2title: SwaggerUI
3description: SwaggerUI
4layout: swagger-ui
5swagger_ui:
6  url: 'https://petstore3.swagger.io/api/v3/openapi.json'
7---

Live example.

Shortcode

You can also embed Swagger UI into your content.

1{{< swagger-ui "https://petstore3.swagger.io/api/v3/openapi.json" >}}