Coder Social home page Coder Social logo

huveragy's Introduction

Huveragy

A simple Hugo partial template that renders a world coverage map using jQuery Vector Map's SVG library and dataset from NaturalEarthData.

Instalation

Go to your Hugo project, create layouts/partials dir and add this repo as submodule:

mkdir -p layouts/partials
git submodule add [email protected]:icostan/huveragy.git layouts/partials/

Configuration

cat <EOF > config.toml
[Params.huveragy]
  countries = { "US"=5, "IN"=2, "RO"=5 }
  colors = ['#dc9658', '#d62728']
EOF

Usage

in HTML pages

Just add the following snippet to any HTML page to display the coverage map.

{{ partial "huveragy/huveragy.html" }}

in Markdown pages

A bit more complicated since Hugo does not allow mixing of Markdown and code/variables but rest assured, I've got this for you. Note the . (dot) after (.Get 0), that is important, that is Hugo's context.

First of all, create a shortcode called partial with the following content.

mkdir -p layouts/shortcodes
cat <EOF > layouts/shortcodes/partial.html
{{ partial (.Get 0) . }}
EOF

Then drop the following snippet in any Markdown page to display the coverage map. Notice the extra < and > brackets to render our little partial shortcode that in turns renders our huveragy partial template.

{{< partial "huveragy/huveragy.html" >}}

Roadmap

  • world coverage
  • continent coverage
  • country coverage: at states/regions/counties level
  • auto-load required JS files based on configuration
  • configurable text for "onTipShow" event
  • DRY everything
  • distribute JS/CSS/HTML files via cdnjs.com
  • try jqvmaps instead jvectormaps library, better options support

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.