npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cloudcannon-hugo

v1.0.11

Published

Generates the files necessary for a hugo site to integrate with CloudCannon CMS

Downloads

7,999

Readme

CloudCannon Hugo

Creates CloudCannon build information for sites made with Hugo.

This tool runs after your Hugo build, reading your configuration to find pages, collections, and data files to create a JSON file used to automatically integrate the site with CloudCannon. This JSON file is written to _cloudcannon/info.json in your destination folder.

Build Status codecov



Installation

You don't have to install anything when building on CloudCannon. This tool is automatically installed before your site is built. This gives you the latest support, new features, and fixes as they are released.

Although not necessary, you can install the tool locally to debug an integration issue.

$ npm install --global cloudcannon-hugo

This gives you access to the cloudcannon-hugo binary.

Configuration

Configuration files should be in the root directory (or the same directory you run cloudcannon-hugo). The first supported file found in this order is used:

  • cloudcannon.config.json
  • cloudcannon.config.yaml
  • cloudcannon.config.yml
  • cloudcannon.config.js
  • cloudcannon.config.cjs

Alternatively, use a specific file with the CLOUDCANNON_CONFIG_PATH environment variable:

$ CLOUDCANNON_CONFIG_PATH=src/cloudcannon.config.js cloudcannon-hugo

Your global CloudCannon configuration is set in this file as well, as it's used as a base to generate _cloudcannon/info.json (used to integrate your site with CloudCannon).

Example content for cloudcannon.config.yml:

# Global CloudCannon configuration
_inputs:
  title:
    type: text
    comment: The title of your page.
_select_data:
  colors:
    - Red
    - Green
    - Blue

# Base path to your site source files
source: src

# The subpath your built output files are mounted at
base_url: /documentation

# Populates collections for navigation and metadata in the editor
collections_config:
  people:
    # Base path for files in this collection, relative to source
    path: content/people

    # Whether this collection produces output files or not
    output: true

    # Collection-level configuration
    name: Personnel
    _enabled_editors:
      - data
  posts:
    path: _posts
    output: true
  pages:
    name: Main pages

# Generates the data for select and multiselect inputs matching these names
data_config:
  # Populates data with authors from an data file with the matching name
  authors: true
  offices: true

paths:
  # The default location for newly uploaded files, relative to source
  uploads: assets/uploads

  # The path to site data files, relative to source
  data: _data

  # The path to site layout files, relative to source
  layouts: _layouts

See the CloudCannon documentation for more information on the available features you can configure.

Configuration is set in cloudcannon.config.*, but the tool also automatically reads and processes the following from Hugo if unset:

  • collections_config from your folder structure inside contentDir in Hugo config
  • paths.layouts from layoutsDir in Hugo config
  • paths.data from dataDir in Hugo config
  • paths.static from staticDir in Hugo config
  • base_url from the --baseURL CLI option or baseURL in Hugo config
  • source from source in Hugo config

Development

Install dependencies:

$ npm i

Lint code:

$ npm run lint

Testing

Run tests:

$ npm test
$ npm run test:integration
$ npm run test:all
$ npm run report-coverage

Link this package locally to test it on a site folder, then run it within your site folder:

$ npm link
$ cd ../my-hugo-site
$ cloudcannon-hugo

Releasing new versions

Prerelease:

$ npm run release:next

Release:

$ npm run release:latest

License

ISC