Coder Social home page Coder Social logo

hugo-citation's Introduction

Hugo Citation

This is a very basic implementation of some kind of citation system for Hugo based in APA. It is still work in progress. Bugs are expected.

Install

You can manually download this repo and place it inside themes/hugo-citation directory.

You can also use git and add it as submodule. Run this inside your Hugo project directory:

git submodule add https://github.com/Fooftilly/hugo-citation.git themes/hugo-citation

Configure

For this to work, you must configure your theme section inside config.toml file:

...
theme = ["...", "...", "hugo-citation"]
...

Usage

You will need to create a json file containing your bibliography. I suggest creating something like this:

# Hugo project directory
├── content
    ├── bibliography
        ├──bib.json

You will also need to edit Hugo's frontmatter inside the file that you want to cite in:

---
...
bibFile: "content/bibliography/bib.json"
citations:
  - "key1"
  - "example2"
---

You will need to add citation key that you want to use, too.

Those keys are provided from the bib.json file. It should look like this:

{
  "key1": {
    "author": "Author1",
    "title": "Title of Work 1",
    "year": "Year1",
    "source": "Source1",
    "url": "URL1"
  },
  "example2": {
    "author": "Author2",
    "title": "Title of Work 2",
    "year": "Year2",
    "source": "Source2",
    "url": "URL2"
  },
  ...
}

Valid fields inside this json file are: author, title, chaptertitle, year, journal, publisher, url, place, translator, editor, pages, volume, number and notes.

I've also indluded bib-gen.html file inside the repo. It can be used to easily generate these json fields.

Shortcodes

To cite a source, use the shortcode {{< cite "key1" >}}. If you want to include a page number, use {{< cite "key1" 22 >}}, replacing "key1" with the actual citation key and 22 with the desired page number.

To generate a bibliography at the end of your document, use the following shortcode:

{{< bibliography >}}

TODO

  • Order bibliography by last name instead of numbers
  • Multiple language support using i18n
  • Footnote style citations
  • Pop-up style windows next to footnote style citations

hugo-citation's People

Contributors

fooftilly avatar

Watchers

 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.