Skip to main content

Repository: govuk-content-api-docs

Documentation for the GOV.UK Content API.

Ownership
#govuk-content-apis owns the repo. #govuk-content-apis-system-alerts receives automated alerts for this repo.
Category
Utilities

README

This is a microsite for providing documentation for the GOV.UK Content API. It is hosted at https://content-api.publishing.service.gov.uk.

This documentation is built from source files in this repository and an OpenAPI specification file for the Content Store application.

The framework for this documentation is provided by the GOV.UK Tech Docs Template.

Updating content

The reference.html page is built using the openapi.yaml file. Changes to content on this page should be made by opening a pull request against the Content Store application.

Other HTML pages are in the /source directory of this repository and are authored using Markdown. You can suggest edits to these pages by making changes on a branch in this project and then opening a pull request.

Metadata

Markdown files may have frontmatter (metadata) added in a standard format at the top of the file.

Mandatory and optional frontmatter fields are specified from the template. In our documentation, we use the following as a minimum:

  • title
  • description
  • weight

In addition, the following frontmatter/metadata about the content itself has been added to each file:

  • type
  • audience
  • product

These fields and their purpose are described in the analysis and planning document, and as a minimum act as a reminder for anyone making future updates to the file.

The content metadata may also be useful for future improvements to search (faceted search), navigation, or page templates and layouts.

Linting markdown

After updating content locally, you can run a linter on the Markdown files (with both the .md and .md.erb file extensions):

make lint-md

This checks your Markdown against standards and best practices, and flags any discrepancies.

Running documentation locally

To run the documentation locally you should have this repository checked out as well as the Content Store.

Installing dependencies

Setting up the documentation requires Ruby. Run the following to install the necessary dependencies:

make ruby-requirements

Linting the documentation requires Node. Run the following to install the node package and dependencies:

make node-requirements

Preview changes

Whilst writing documentation you can run a middleman server to preview how the published docs will look in the browser. When you save a change, the preview in the browser will automatically refresh the HTML pages. However, for changes to the openapi.yaml file, you will need to restart the preview.

This preview is only available on your own computer. Others won’t be able to access it if they are given the link.

Run the following command to start the middleman server:

make server

You should now be able to access the preview at http://localhost:4567.

Publishing changes

Changes are deployed automatically after merging into the main branch.

To manually deploy a change, run the following command on your local machine:

make publish

This will push your change to the gh-pages branch and deploy to GitHub Pages.

License

MIT License