Giter VIP home page Giter VIP logo

dot-org-hugo-theme's Introduction

Dot-Org theme for Hugo

This Hugo theme is ideal for powering the website of a small organization. It was built initially for the TODO Group and has the following strengths:

  • Modern - simple yet effective modern design
  • Accessible - design and markup comply with WCAG 2.1 AA guidelines
  • Performant - HTML/CSS/JS written from scratch to be as fast as possible without relying on frameworks or libraries
  • Multilingual - ready to support multiple languages of content
  • Mega Menu - large menu with dropdown sections
  • FAQ accordion - FAQ page with accordion structure
  • Search - PageFind search is integrated

View demo site

Installation

There are two main methods of installing this theme to an existing Hugo site:

1) Download it

Inside the folder of your Hugo site, run:

git clone https://github.com/cncf/dot-org-hugo-theme themes/dot-org-hugo-theme

This downloads the repo from GitHub and puts the contents in your themes folder.

To update your theme to future versions:

cd themes/dot-org-hugo-theme
git pull

2) Use git submodule

Inside the folder of your Hugo site run:

git submodule add https://github.com/cncf/dot-org-hugo-theme.git themes/dot-org-hugo-theme

This downloads the repo from GitHub and puts the contents in your themes folder as a git sub-module.

To update your theme to future versions:

git submodule update --remote --merge

Installing dependencies

Copy (at least) the following files from the themes exampleSite to the root folder of your project.

  • themes/dot-org-hugo-theme/exampleSite/package.json
  • themes/dot-org-hugo-theme/exampleSite/postcss.config.js

For ease you can run from the command line:

cp themes/dot-org-hugo-theme/exampleSite/package.json .
cp themes/dot-org-hugo-theme/exampleSite/postcss.config.js .

We recommend a config directory approach to replace your config.toml or hugo.toml file. To get up and running quickly with the default config, you can copy the following folder to the root of your site:

  • themes/dot-org-hugo-theme/exampleSite/config/

From the command line in your project root, you can run the following to copy the themes exampleSite config to your project:

cp -r themes/dot-org-hugo-theme/exampleSite/config ./config

After that, run this command to install dependencies (requires node.js).

npm install

You can then run a local server using:

npm run start

or you can build your site using:

npm run build

Config files

See /exampleSite/config/ for example configuration files.

You should copy these across or merge them with your existing config.

Custom front matter

We have created custom front matter to use in your markdown files:

Hide the page title / article header

showHeader: false

Add noindex to a page

noindex: true

Search index

Pagefind can be used to search the contents of your site. We include a search.html in the theme that is already set up. The search and results UI can also be inserted into any page using the shortcode. For Pagefind to work, the pagefind index must be built from the files in your public directory. First, make sure your site it built, and then install pagefind and index the site:

npm run build
npx -y pagefind --site public

Every time your content is updated, you need to update the search index by again running npx -y pagefind --site public, so this should be part of your deployment process.

Custom shortcodes

You can use our custom shortcodes to quickly style your website in markdown. Due to the way Hugo deals with nested content, particularly nested shortcodes, you may find that shortcodes that are children of other shortcodes do not render as they should. If this happens to your site, this can often be resolved by allowing Hugo to render "unsafe" HTML. Add the following to your config YAML file:

markup:
  goldmark:
    renderer:
      unsafe: true

Button

There is a button ready to be inserted in to markdown files:

{{< button link="/path/to/page" text="Default Button" >}}
{{< button link="/path/to/page" style="secondary" text="Secondary Button" >}}
{{< button link="/path/to/page" style="tertiary" text="Tertiary Button" >}}

Options:

  • link # (required) the button link
  • text # (required) the button text
  • style # (optional) secondary, tertiary

Cards

An outlined box that is useful for highlighting information or using to wrap list elements.

{{< cards count=2 >}}
{{< card >}}
## Special Feature 1
Lorem ipsum dolor sit amet consectetuer adipiscing elit aenean commodo
{{< spacer >}}
[Download](#)
{{< /card >}}
{{< card >}}
## Special Feature 2
Lorem ipsum dolor sit amet consectetuer adipiscing elit aenean commodo
{{< spacer >}}
[About us](#)
{{< /card >}}
{{< /cards >}}

Options:

  • count # (optional) number of columns on desktop; 2,3,4. Default: 3.

Columns

A responsive column structure.

{{< columns >}}
{{< column >}}
Column 1
{{< /column >}}
{{< column >}}
Column 2
{{< /column >}}
{{< /columns >}}

Options:

  • count # (optional) number of columns on desktop; 2,3,4. Default: 3.

Current Year

Insert the current year easily with this shortcode:

{{< current_year >}}

Useful for copyright notices and evergreen blog content.

iFrame

Insert an iFrame with your desired content.

{{< iframe title="My slides" src="https://www.slideshare.net/slideshow/embed_code/key/vTNvkwIXN4pmr8" >}}

Options:

  • src # (required) the page to display
  • width # (optional)
  • height # (optional)
  • title # (optional) the title of the iframe for accessibility
  • loading # (optional) defaults to lazy

Img

Inserts an image in a more advanced format than standard Hugo syntax.

{{< img src="/img/blog/image-name.png" >}}

Options:

  • src # (required) the image link
  • alt # (optional) describing the image, defaults to filename
  • width # (optional) recommended
  • height # (optional) recommended
  • caption # (optional) markdown is accepted
  • loading # (optional) defaults to lazy, use eager above the fold

Intro

Formats a paragraph with larger text as suitable for an introduction paragraph at the top of a page.

{{< intro >}}
Paragraph text...
{{< /intro >}}

Linebreak

Sometimes markdown can bunch paragraphs together. You can force a line return using the linebreak shortcode.

{{< br >}}

Responsive Table

Wrap your large tables with this shortcode so they overflow on mobile:

{{< responsive_table >}}
| Option | Option | Description |
| ------ | ------ | ----------- |
| one    | data   | path to data files to supply the data that will be passed into templates. |
| two    | engine | engine to be used for processing templates. Handlebars is the default. |
| three  | ext    | extension to be used for dest files. |
{{< /responsive_table >}}

Search form

A search form for querying the pagefind index and showing results.

{{< search_form >}}

Spacer

A spacer is useful for spacing out content on your page. By default our spacer inserts a 50px height space. Our spacer is responsive, so on mobile devices the value is reduced by 50% (i.e. 50px space becomes 25px space).

{{< spacer >}}
{{< spacer 100 >}}

Table of Contents (TOC)

Insert a Table of Contents automatically in to your page. Picks up on all H2 elements on the page.

{{< toc >}}

YouTube Enhanced

A privacy friendly and fast YouTube embed.

{{< youtube_enhanced id="9oVr7rrNZVI" >}}

For embedding playlists, a singular video id must be mentioned as playlists do not have a thumbnail.

{{< youtube_enhanced id="xPSXtoJNGLs" title="Play Videos from Kubecon" playlistid="PLj6h78yzYM2PyrvCoOii4rAopBswfz1p7" >}}

Options:

  • id # (required)
  • title # (optional) defaults to Play Video
  • playlistid # (optional) your playlist ID
  • autoload # (optional) defaults to false
  • start # (optional) the start time in seconds, default 0

Setting up a local instance for improving this theme

If you want to create improvements for this theme for everyone, follow these instructions to launch the exampleSite.

git clone https://github.com/cncf/dot-org-hugo-theme.git
cd dot-org-hugo-theme/exampleSite
npm install
npm run dev:start

Other npm commands for working with a local instance

  • npm run dev:start - Starts the local dev environment using exampleSite
  • npm run dev:start:with-pagefind - Starts the local dev environment using exampleSite with working pagefind search
  • npm run dev:build - Builds the site using exampleSite

Showcase

Check out some themes that are using the Dot-Org theme for Hugo:

dot-org-hugo-theme's People

Contributors

cjyabraham avatar thetwopct avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dot-org-hugo-theme's Issues

Menu rotating arrows not displayed

The demo site has the following:

image

However, on a site I'm building I don't see these elements.

image

The only SCSS I override is the styles.scss file to introduce a _news.scss file which is based on the _blog.scss theme file.

I do have a home.scss file based on that from the Deep Casuality site but I don't think that is the issue because these arrows are visible on that site.

I presume these rotating arrows are driven by the _header.scss file but I have not overridden this file. Thanks for your time.

Is there an option to place a custom main page instead of dynamic list of pages?

Hi,

I just adopted the theme and so far its been great. Things are working out of the box, customization is easy, site speed is phenomenal, and I got a lot done in little time.

However, there is one issue I cannot get my head around: The main page "/" gets cluttered with a dynamic list of all other pages.

See the site preview:

https://beta-7j9.pages.dev/

Is there an option to switch this off so I can just write a custom welcome page instead?

I read through the documentation, but wasn't able to find anything.

Please let me know.

Thank you

Implement noindex facility

Currently there is no way (by default in Hugo) to make a page noindex via front matter.

This is needed for the individual FAQ pages, otherwise there may be duplicate content issues

Missing translation warnings despite default values provided if no i18n translation exists

>{{ i18n "by" | default "by" }}

<a href="{{ .value }}" title="{{ i18n "social_link_title" (dict "SiteTitle" $siteTitle "Network" (humanize .key)) | default (printf "%s on %s" $siteTitle (humanize .key)) }}">

image

Despite these warnings I believe the default values are used. Creating a /i18n/en.yaml with these keys (and values) removes the warnings.

Also, why is it only en translations that are missing if this theme can support multiple languages?

Unable to override favicon

I have placed the following files of my own favicon in /static/ but they do not override the themes favicon.

favicon-16x16.png
favicon-32x32.png
favicon.ico

FR: Menu children should collapse on mobile when selecting between menus

On mobile, if you select one menu with children you see the menu, its children below it and then the other menus below that. However, if you then select another top-level/parent menu the children of the first top-level.parent menu are still visible. I would expect the children to collapse when selecting between top-level/parent menus. ideally, if the hamburger menus on mobile could behave like the FAQ page when selecting between the FAQs.

I hope what I describe is clear.

[Feature Request] Add Search Option

I was recently doing some work on the TODO Group website and realized that the site does not have a search function, which is not conducive to retrieving information. Would it be possible to add a search option to this hugo theme, there are some recommendations in the hugo documentation?

recommended

Open source

Commercial

Make breadcrumbs multi-level, semantic

Switch out and style current breadcrumb to be multi-level, semantic and add aria labels.

<nav class="" aria-label="breadcrumbs">
    <ol class="">
        {{- range .Ancestors.Reverse }}
      <li class="breadcrumb">
        <a href="{{ .RelPermalink }}">{{ if .IsHome }}{{ i18n "home" }}{{ else }}{{ .Title }}{{ end }}</a>
      </li>
      <span class="" aria-hidden="true">»</span>
      {{- end }}
    </ol>
  </nav>

languages.en.description: custom params on the language top level is deprecated

WARN  config: languages.en.description: custom params on the language top level is deprecated and will be removed in a future release. Put the value below [languages.en.params]. See https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120
WARN  config: languages.es.description: custom params on the language top level is deprecated and will be removed in a future release. Put the value below [languages.es.params]. See https://gohugo.io/content-management/multilingual/#changes-in-hugo-01120

exampleSite: site.Language.Params is deprecated, use site.Params directly

Per the Hugo docs.

Considering this should the following be moved to params.yaml?

params:
title: "Site Title"
description: "Site Description"
### accessibility ###
accessibility:
skip_text: "Skip to content"
help_text: "Accessibility Statement"
help_url: "/example-page/"
### calls to action ###
main_cta:
text: "Join"
link: "/example-page/"
footer_cta:
text: "Join us"
link: "/example-page/"
### copyright (markdown can be used) ###
copyright: "Copyright &copy; {{< current_year >}} Company Name. All Rights Reserved. [Dot Org Theme](https://github.com/cncf/dot-org-hugo-theme) for Hugo by [CNCF](https://www.cncf.io)."
github_edit: "Edit this page on GitHub"

Feature: Back to top triangle on long pages

This one is a nice-to-have / low priority feature.

Basically, on my site I roughly have to kind of pages.

  1. Short topic specific
  2. Long documentation

The second kind tends to become really long and once you reach the bottom, it's a long scroll back to the top.

Example: https://deepcausality.com/docs/intro/

What would be ideal is this back to top triangle that jumps right back to the top of the page.

Example: The Guardian

Screenshot 2023-09-17 at 7 26 59 PM

Ideally, this triangle would appear the moment you start scrolling down. If the page isn't long enough, it never appears. Or, setting a boolean flag in the front-matter of the markdown file would be an alternative way to enable/disable the triangle as it's not always needed or wanted.

Also the text "Back to top" might be good as a tooltip that pop's up when hovering over the triangle just to conserve valuable space on mobile.

Currently, I have bypassed the problem by linking to the next page at the bottom of the current page hence this is really low priority but definitely nice to have.

Menu names do not align in footer

Taken from the TODO Group site. The blog menu name does not have any submenus listed under it to align with the other menu items. The blog page however does have blog posts. Perhaps link to 3-4 of the most recent blog posts to fix the alignment?

image

On the other real life example site Deep Causality it seems any menus with no submenus are grouped together on the right of the menu items with submenus.

image

Add an index / home page in the theme

Originally mentioned in #6, another user of the theme has also been confused that there is no easily editable index page, and also that the i18n usage in a template is not explained. We should add one to the theme. This would also improve the demo home page look rather than being a list of pages.

Secondary button hover style should not look like primary button

I think having the secondary button hover color be identical to the primary color button is problematic, especially when you have both buttons next to each other. You end up getting two identical buttons showing when you hover over the secondary button. In this screenshot I am currently hovering over the middle button which turned from bright green to this color (try on demo page here):

Screenshot 2023-09-17 at 11 17 59 AM

I think a good fix is to make the secondary button hover color a slightly darker shade of its regular color, maybe try #4d8307 ?

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.