Skip to content

A Hugo module to add authentication powered by Hanko to your Hinode site

License

Notifications You must be signed in to change notification settings

gethinode/mod-hanko

Repository files navigation

Hinode Module - Hanko

A Hugo module to add authentication powered by Hanko to your Hinode site

About

Logo

Hinode is a clean blog theme for Hugo, an open-source static site generator. Hinode is available as a template, and a main theme. This repository maintains a Hugo module to add authentication powered by Hanko to a Hinode site. Visit the Hinode documentation site for addtional installation instructions. This module requires a Hanko account, check out the Hanko docs to get you started.

Contributing

This module uses semantic-release to automate the release of new versions. The package uses husky and commitlint to ensure commit messages adhere to the Conventional Commits specification. You can run npx git-cz from the terminal to help prepare the commit message.

Configuration

A login template is available in the layouts folder, which is automatically mounted into your site. You can reference this template by setting layout: login in the frontmatter of your content page. When the parameter authenticate is set to true, the login page will include the Hanko Auth Component. The Login Component is included instead. For example, create a login page content/login.md with the following content.

---
title: Login
description: Login page
layout: login
params:
  authenticate: false
---

This module supports the following parameters (see the section params.modules in config.toml):

Setting Default Description
endpoint Hanko API URL, such as https://f4****-4802-49ad-8e0b-3d3****ab32.hanko.io. Check the Hanko console to retrieve the value.
login-redirect Redirect destination after a successful login, e.g. / to redirect to the site's homepage.
logout-redirect Redirect destination after a successful logout, e.g. /login/ to redirect to the login page.
timeout-redirect Redirect destination when the session has expired, e.g. /login/ to redirect to the login page. A modal dialog is shown to confirm the redirect.

When using Content Security Policies, be sure to add the endpoint to the connect-src safelist. For example, the following configuration in your site parameters will enable connections to the example Hanko API URL.

[modules.hanko.csp]
    connect-src = [
        "f4****-4802-49ad-8e0b-3d3****ab32.hanko.io"
    ]

About

A Hugo module to add authentication powered by Hanko to your Hinode site

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •