/hugo-openapispec-shortcode

A shortcode for Hugo https://gohugo.io/ which allows you to include Open API Spec (formerly Swagger) in a page.

Primary LanguageJavaScriptMIT LicenseMIT

hugo-openapispec-shortcode

============================

This is a Hugo Shortcode to embed the Open API Spec (formerly known as Swagger Spec) in a page.

You can see an example here and the source for the example here.

Installation

==============

This repository has the following files that need to be copied into your Hugo site's directory:

  • ./layouts/shortcodes/oai-spec.html to your ./layouts/shortcodes directory
  • ./static/scripts/* to your ./static directory
  • ./static/swagger-ui/* to your ./static directory

Usage

=======

To embed the API documentation below you just need to include the following shortcode:

{{< oai-spec url="http://petstore.swagger.io/v2/swagger.json" api_key="special-key" >}}

There are just two options:

  • url (required) - the url of the Open API Spec
  • api_key (optional) - the API Key you want embedded in your document

Known Issues

==============

Currently known issues:

Live Reload currently fails when running locally. I'd recommend using the following command line options for Hugo which disables live reload and manually reload your page to see changes:

hugo server --watch --disableLiveReload