Giter Club home page Giter Club logo

hugo-module-tnd-notice's Introduction

TND Notice.

This module helps add a quick notice on a website. Notice information can be configured solely through the site's configuration file or through a page referenced in the site's configuration file.

Usage

Simply add {{ partialCached "tnd-notice/print.html" . "tnd-notice/print" }} in your template file, baseof.html or other.

Customize markup.

  1. Create homonymous partial files in your project at /layouts/partials/tnd-notice/print.html
  2. Follow comments from the module's own print.html

Configure

API

There are two ways to set the notice, either through the site config or through a page. Either solution uses the same keys under a reserved group key tnd_notice

Available keys are:

  • title: The notice title.
  • content: The notice content or body.
  • page: If the notice should link to a page. This needs to be a string formated for Hugo's GetPage function. This is only available through the site configuration.
  • disable: (default false) If set to true, the notice won't show.

Through site configuration

tnd_notice:
  title: Something came up
  content: "Sed posuere consectetur est [lobortis](https://google.com). Something else."
  page: /notice.md

Through content file referenced in configuration file

For ease of use, if a page is set, user can add the notice title and and notice content on the page Front Matter itself. They will overwride the module configuration on the site level.

This allows users to switch between various notices without having to delete/rewrite settings.

---
title: Important Notice
tnd_notice:
  title: Something came up
  content:  - |
    Sed posuere consectetur est at [lobortis](https://google.com).
    Something else.
---

Note that if the referenced page has a body content, a "Read more" button, pointing to said page will be added after the Notice content.

Not publishing the notice page (since Hugo 0.64.0).

If for some reason user wishes to configure the notice through a content file but would rather not have it published, they should use Hugo settings to make sure given page is not surfaced by Hugo.

---
title: Important Notice
tnd_notice:
  title: Something came up
_build:
  render: false
  list: false
---

Localisation

For now, only one string is produced by the Module as a "Read more" button. To localize said string, simply add this to your i18n directory language files:

# i18n/en.yaml
- id: tnd_notice_read_more
  translation: My own read more

Important: If your site language is not english, and no translation is provided for tnd_notidce_read_more the link will fail.

hugo-module-tnd-notice's People

Contributors

mountainbug95 avatar regisphilibert avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.