An open API service indexing awesome lists of open source software.

https://github.com/deuill/hugo-module-listenbrainz

A Hugo module for including a 'Now Playing' widget on your site, powered by ListenBrainz
https://github.com/deuill/hugo-module-listenbrainz

hugo hugo-module listenbrainz

Last synced: 26 days ago
JSON representation

A Hugo module for including a 'Now Playing' widget on your site, powered by ListenBrainz

Awesome Lists containing this project

README

          

# ListenBrainz Module for Hugo

A ready-to use module for Hugo, providing a layout and shortcode for adding a "Now Listening" widget
powered by [ListenBrainz][listenbrainz].

## Installation

Firstly, make sure to initialize the [Hugo module system][hugo-modules] for your site, if you haven't done so
already:

```sh
hugo mod init
```

Then, add the ListenBrainz module to your site configuration:

```yaml
module:
imports:
- path: go.deuill.org/hugo-module-listenbrainz
```

Remember to keep this and other modules on your site updated with `hugo mod get -u`.

## Configuration

By default, the ListenBrainz module expects to be configured in the site-wide configuration file,
e.g. for `hugo.yaml`:

```toml
params:
listenBrainz:
username: example
```

Which would fetch listening data for [listenbrainz.org/user/example][listenbrainz-example]. It is,
however, also possible to pass different usernames in both layout inclusions and shortcode
invocations; see the section below for more information.

## Use

The ListenBrainz module can be used as either a layout:

```html
{{- with .Site.Params.listenBrainz.username}}
{{partial "listenbrainz.html" .}}
{{- end}}
```

Or a short-code:

```markdown
# Example

Here's what I'm listening to right now:

{{< listenbrainz >}}

And here's what this other user is listening to:

{{< listenbrainz username="other" >}}
```

The short-code example above shows how a non-default username might also be specified; site-wide
configuration will be used if no specific username is given.

## License

All code in this repository is covered by the terms of the MIT License, the full text of which can be found in the LICENSE file.

[hugo-modules]: https://gohugo.io/hugo-modules/use-modules/#use-a-module-for-a-theme
[listenbrainz]: https://listenbrainz.org
[listenbrainz-example]: https://listenbrainz.org/user/example/