Coder Social home page Coder Social logo

hugo-theme-cactus's Introduction

Cactus

A hugo theme for personal blog. Fork from hexo theme cactus created by @probberechts.

Live demo on github pages.

Some works are still in progress. See TODOS below.

Install

  1. clone cactus to your hugo site's themes folder.
git clone https://github.com/monkeyWzr/hugo-theme-cactus.git themes/cactus
  1. change your theme to cactus in your site config
# config.toml

theme = "cactus"
  1. config your site. See [Config] or a complete config sample
  2. test your site
hugo server
  1. publish your site in your prefered way. See hugo's doc: Hosting & Deployment

Config

Color themes

[params]

  colortheme = "white" # dark, light, white, or classic

Custom CSS

[params]
  css = ["css/custom.css"]

You can add multiple custom stylesheets which will be loaded after the main theme css. For example, the above line will load the CSS-file placed at /static/css/custom.css.

Navigation

# Main menu which appears below site header.
[[menu.main]]
name = "Home"
url = "/"
weight = 1

[[menu.main]]
name = "All posts"
url = "/posts"
weight = 2

[[menu.main]]
name = "Tags"
url = "/tags"
weight = 3

[[menu.main]]
name = "About"
url = "/about"
weight = 4

Homepage settings

  • description: description will be displayed in the homepage. Markdown syntax is supported in the description string.
[params]

  description = "Hugo is a general-purpose website framework. Technically speaking, Hugo is a static site generator. Unlike systems that dynamically build a page with each visitor request, Hugo builds pages when you create or update your content. Since websites are viewed far more often than they are edited, Hugo is designed to provide an optimal viewing experience for your website’s end users and an ideal writing experience for website authors."
  • set your main section (used as the link for the "writings" title on the homepage)
[params]
  mainSection = "posts"
  • change the default main section title from Writings, to something else:
[params]
  mainSectionTitle = "Blog"
  • Show only the 5 most recent posts (default)
[params]
  showAllPostsOnHomePage = false
  postsOnHomePage = 5
  • show all posts
[params]
  showAllPostsOnHomePage = true
  postsOnHomePage = 5 # this option will be ignored
  • show tagsoverview (default) or not
[params]
  tagsOverview = true
  • display the table of contents inline on blog posts, rather than as part of the navigation menu:
[params]
  tocInline = true
  • show projects list (default) or not.
[params]
  showProjectsList = true
  projectsUrl = "https://github.com/monkeyWzr"

Projects section will not be shown if no data file is detected. See Projects list below.

Projects list

Create your projects data file data/projects.yaml|toml|json. Hugo support yaml, toml and json formats. for former hexo cactus users: please assign your json array to a list key.

for example, data/projects.json:

{
   "list": [
      {
         "name":"Hexo",
         "url":"https://hexo.io/",
         "desc":"A fast, simple & powerful blog framework"
      },
      {
         "name":"Font Awesome",
         "url":"http://fontawesome.io/",
         "desc":"The iconic font and CSS toolkit"
      }
   ]
}

Social media links

[[params.social]]
  name = "github"
  link = "https://github.com/monkeyWzr"

[[params.social]]
  name = "email"
  link = "[email protected]" # no need for "mailto:" at the start

[[params.social]]
  name = "linkedin"
  link = "https://www.linkedin.com/in/monkeywzr/"

The name key expects the name of a Font Awesome icon.

Copyright

Assign your copy right to .Site.Copyright. Cactus will append current year to the head.

TODO: Customizable copyright year

copyright = "Zeran Wu" # cactus theme will use site title if copyright is not set

Comments

Comments is disabled by default. Enable comments in your .Site.Params.

[params]
  [params.comments]
    enabled = true
    # engine = "disqus" # in progress

You can also enable/disable comments per post. in your posts' front matter, add:

comments: true

The site config is ignored when comments option exists in front matter.

The default engine is disqus. By now only disqus is supported in cactus. I will add more options sooner or later. See Comments Alternatives

Before using disqus, you need to register and get your disqus shortname. Assign your shortname in .Site.disqusShortname, or cactus will use .Site.Title by default.

disqusShortname = "wzr" # cactus will use site title if not set

highlight

Use hugo's built-in syntax highlighting.

default config:

[markup]
  [markup.highlight]
    codeFences = true
    guessSyntax = false
    hl_Lines = ""
    lineNoStart = 1
    lineNos = false
    lineNumbersInTable = true
    noClasses = true
    style = "monokai"
    tabWidth = 4

Analytics

Cactus uses hugo's bulit in analytics templates. Check hugo's documents for details.

Set you tracking id in your site config.

googleAnalytics = "UA-XXXXXXXX-XX" # or G-XXXXXXXX if you are using Google Analytics v4 (gtag.js)

If you are using Google Analytics v3 (analytics.js), you can switch to asynchronous tracking by set params.googleAnalyticsAsync to true.

[params]
googleAnalyticsAsync = true # not required

RSS

The rss feed is not generated by default. you can enable it in your site config:

[params]
  rss = true

The rss link will be https://example.com/index.xml assuming your baseURL is set to https://example.com/

Please also check Configure RSS

Mathjax

Cactus supports mathjax. Just add mathjax option in your site config:

[params]
  mathjax = true  # not required

You can also enable/disable mathjax per post. In your posts' front matter, add:

mathjax: true # or false

The site config will be ignored when mathjax option exists in front matter.

Archive

Pagination on posts archive can be disabled to show all posts in chronological order

[params]
  showAllPostsArchive = true # or false (default)

TODOS

  • More comments engines
  • RSS
  • I18n
  • Analytics
  • Local Search
  • toc template
  • Customizable copyright year
  • gallery
  • expose mathjax configuration

License

MIT

hugo-theme-cactus's People

Contributors

akleemans avatar apettenati avatar cristiklein avatar david-bakin avatar fedragon avatar krisives avatar lollipopman avatar monkeywzr avatar nizzlay avatar olivercodes avatar oneleaftea avatar onweru avatar ourssansplus avatar rdimaio avatar regeda avatar ronangaillard avatar rpoisel avatar sp8c3 avatar switchswap avatar ungeschneuer avatar

Watchers

 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.