Giter VIP home page Giter VIP logo

jekyll-gists-meta's Introduction

Jekyll::Gists::Meta

A simple plugin for Jekyll that makes a call to the GitHub GraphQL API v4 to collect metadata for a user's gists and store it in a json file (gists-meta-data.json) in the Jekyll site data_dir.

Installation

Add this line to your application's Gemfile:

gem 'jekyll-gists-meta', group: :jekyll-plugins

And then execute:

$ bundle

Or install it yourself as:

$ gem install jekyll-gists-meta

Then add the following to your site's _config.yml:

plugins:
  - jekyll-gists-meta

Usage

Because the GitHub GraphQL API requires an authorization token for access, you will need to ensure that the enviroment variable JEKYLL_GITHUB_TOKEN is set, i.e.

JEKYLL_GITHUB_TOKEN=<token string here>

in order for the query to work and make the metadata available.

By default the plugin will attempt to source a GitHub user login via the github-metadata plugin if installed. A user login may alternately be specified in the _config.yml file as gists_user. Any value here will supersede any value sourced from github-metadata.

The plugin will run when the server is started and create a JSON data file, gists-meta-data.json, of select GitHub metadata fields for a user's gists in the site's data directory, which is ./_data by default. Gists appear in the file in descending order by creation date. The plugin overwrites any existing file of the same name.

Once the datafile is populated, you may access its contents within Jekyll using Liquid. For example, to list all gists in the file and linkify them:

{% if site.data.gists-meta-data %}
  <section>
    <h2>Gists</h2>
    <ul>
      {% for myedge in site.data.gists-meta-data.data.user.gists.edges %}
        <li>
          <a href="https://gist.github.com/{{ myedge.node.name }}">{{ myedge.node.description }}</a>
        </li>
      {% endfor %}
    </ul>
  </section>
{% endif %}

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jamesluberda/jekyll-gists-meta. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Jekyll::Gists::Meta project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

jekyll-gists-meta's People

Contributors

jamesluberda avatar

Stargazers

Steven Westmoreland avatar

Watchers

James Cloos avatar  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.