GithubHelp home page GithubHelp logo

haakonhr / hugo-flex Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ldeso/hugo-flex

0.0 1.0 0.0 259 KB

A lightweight Hugo theme leveraging CSS Flexbox

Home Page: https://themes.gohugo.io/hugo-flex/

License: Apache License 2.0

HTML 69.38% CSS 22.60% JavaScript 8.02%

hugo-flex's Introduction

Hugo Flex

A lightweight Hugo theme leveraging CSS Flexbox

Features

  • Flexbox-based responsive layout
  • Full posts in RSS feed
  • Themed RSS feed
  • No framework
  • No javascript
  • 100% speed score on PageSpeed Insight

Optional features:

  • Show summaries on homepage
  • Schema.org, Open Graph and Twitter Cards metadata
  • Utterances comments widget
  • Custom CSS and JS can be added site-wide, or dynamically with shortcodes
  • Built-in shortcodes:
    • Netlify contact form
    • On-click Soundcloud player

Installation

From the website root:

git submodule add https://github.com/de-souza/hugo-flex.git themes/hugo-flex

The theme must be set in the website config:

echo 'theme: hugo-flex' >> config.yaml

Updating

From the website root:

git submodule update --remote --rebase

Example Site

The official hugoBasicExample repository may be used as an example site. For a complete starter template for using this theme with in-depth explanations, see hugo-flex-example.

Configuration

Configuration options may be copied and modified from the theme defaults:

params:
  color: teal           # Any color in CSS syntax
  width: 42rem          # Any length in CSS syntax
  footer: Except where otherwise noted, content on this site is licensed under a
    a <a href="http://creativecommons.org/licenses/by/4.0/" rel="license">
    Creative Commons Attribution 4.0 International License</a>.
  rss: To subscribe to this RSS feed, copy its address and paste it into your
    favorite feed reader.
  summaries: false      # Set to true to show summaries of posts on homepage
  divider: '\2015\2015' # Set to false to remove divider below posts on homepage
  schema: false         # Set to true to add Schema.org metadata
  opengraph: false      # Set to true to add Open Graph metadata
  twittercards: false   # Set to true to add Twitter Cards metadata
  utterances:
    repo:               # Set to Utterances repo URL to add Utterances comments
    issueterm: pathname
    theme: github-light
  netlify:
    honeypot: false     # Set to true to add honeypot field in contact form
    recaptcha: false    # Set to true to add recaptcha challenge in contact form
  # css:                # Uncomment to add custom CSS from a list of files
  #   - css/foo.css
  #   - bar.css
  # js:                 # Uncomment to add custom JS from a list of files
  #   - js/foo.js
  #   - bar.js

menu:
  nav:
  - name: About
    url: about/
    weight: 1
  - name: Posts
    url: post/
    weight: 2
  - name: Tags
    url: tags/
    weight: 3
  - name: Categories
    url: categories/
    weight: 4
  - name: RSS
    url: index.xml
    weight: 5

Built-In Shortcodes

Netlify Contact Form

A contact form working with the built-in Netlify form handling service is inserted with the shortcode:

{{< contact >}}

A custom success page URL may be given as a parameter:

{{< contact "/success" >}}

On-Click Soundcloud Player

An on-click Soundcloud Player is inserted with the shortcode:

{{< soundcloud 123456789 >}}

The parameter is a track ID and can be extracted from the "embed" sharing menu on the track webpage.

Custom CSS and JS

Site-Wide

Custom CSS and JS can be added to all the pages on the website. To do so, the relevant filenames must be added to the website config file:

params:
  css:
    - css/foo.css
    - bar.css
  js:
    - js/foo.js
    - bar.js

The paths are relative to the project working directory.

Dynamically Embedded

To embed CSS and JS resources on specific pages of the website, they must be added to the .Scratch variable from a shortcode template. As a result, they will be loaded in pages where the shortcode is used. For instance, a shortcode template could contain:

{{ resources.Get "myscript.js" | fingerprint | .Page.Scratch.SetInMap "js" "myscript" }}

As an example, here is the complete template for the Soundcloud shortcode:

{{ resources.Get "css/soundcloud.css" | minify | fingerprint | .Page.Scratch.SetInMap "css" "soundcloud" }}
{{ resources.Get "js/soundcloud.js" | minify | fingerprint  | .Page.Scratch.SetInMap "js" "soundcloud" }}
<div class="Soundcloud" data-id="{{ .Get 0 }}"></div>

License

This theme is licensed under the Apache License 2.0.

hugo-flex's People

Contributors

haakonhr avatar jasonc avatar ldeso avatar puhoy 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.