All Projects → alireza-ahmadi → Hoor

alireza-ahmadi / Hoor

Licence: mit
Add Shamsi(Jalali) date to Hugo based websites with ease

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Hoor

Minimo
Minimo - Minimalist theme for Hugo
Stars: ✭ 453 (+1577.78%)
Mutual labels:  hugo
Website
Let's Encrypt Website and Documentation
Stars: ✭ 629 (+2229.63%)
Mutual labels:  hugo
Hugo Theme Terminal
A simple, retro theme for Hugo
Stars: ✭ 832 (+2981.48%)
Mutual labels:  hugo
Hugo Theme Meme
You can’t spell aWEsoME without MEME! 😝
Stars: ✭ 459 (+1600%)
Mutual labels:  hugo
Ox Hugo
A carefully crafted Org exporter back-end for Hugo
Stars: ✭ 591 (+2088.89%)
Mutual labels:  hugo
Wowchemy Hugo Modules
🔥 Hugo website builder, Hugo themes & Hugo CMS. No code, build with widgets! 创建在线课程,学术简历或初创网站。
Stars: ✭ 6,093 (+22466.67%)
Mutual labels:  hugo
Hugo Theme Zzo
Make a blog with hugo zzo theme!
Stars: ✭ 438 (+1522.22%)
Mutual labels:  hugo
Hugo Elasticsearch
Generate Elasticsearch indexes for Hugo static sites by parsing front matter
Stars: ✭ 19 (-29.63%)
Mutual labels:  hugo
Actions Hugo
GitHub Actions for Hugo ⚡️ Setup Hugo quickly and build your site fast. Hugo extended, Hugo Modules, Linux (Ubuntu), macOS, and Windows are supported.
Stars: ✭ 588 (+2077.78%)
Mutual labels:  hugo
Hugo Theme Stack
Card-style Hugo theme designed for bloggers
Stars: ✭ 720 (+2566.67%)
Mutual labels:  hugo
Mainroad
Responsive, simple, clean and content-focused Hugo theme based on the MH Magazine lite WordPress theme
Stars: ✭ 509 (+1785.19%)
Mutual labels:  hugo
Hugo Theme Hello Friend
Pretty basic theme for Hugo that covers all of the essentials. All you have to do is start typing!
Stars: ✭ 586 (+2070.37%)
Mutual labels:  hugo
Hugo Theme Jane
A readable & concise theme for Hugo
Stars: ✭ 669 (+2377.78%)
Mutual labels:  hugo
Disqusjs
💬 Render Disqus comments in Mainland China using Disqus API
Stars: ✭ 455 (+1585.19%)
Mutual labels:  hugo
Hugo Social Metadata
Hugo theme component to add social metadata to your Hugo site with minimal configuration
Stars: ✭ 17 (-37.04%)
Mutual labels:  hugo
Hugo Theme Introduction
Minimal, single page, smooth-scrolling theme for Hugo static site generator.
Stars: ✭ 441 (+1533.33%)
Mutual labels:  hugo
Hugodocs
The source for https://gohugo.io/
Stars: ✭ 637 (+2259.26%)
Mutual labels:  hugo
Dominhhai.github.io
My Blog
Stars: ✭ 8 (-70.37%)
Mutual labels:  hugo
Hugo Utilitybelt
A theme consisting of partials that can be added as a theme component for any Hugo site
Stars: ✭ 17 (-37.04%)
Mutual labels:  hugo
Hugo Tranquilpeak Theme
A gorgeous responsive theme for Hugo blog framework
Stars: ✭ 686 (+2440.74%)
Mutual labels:  hugo

Hoor

godoc Build Status

Hoor is the Persian word for sun.

Hoor is a command line tool for adding Shamsi date feature to Hugo based websites.

Installation

You can download the latest version of Hoor from Releases page. Also, if you already installed Golang toolchain, you can install hoor by running the following command:

go get github/alireza-ahamdi/hoor

Usage

IMPORTANT NOTE

Current version is the first implementation of this utility, if you want to use it, please make sure that you have a backup of your website first.

Adding Shamsi date to all contents(or changing date format):

cd path/to/your/website
hoor

Adding Shamsi date to a single content:

cd path/to/your/website
hoor -i content/post/foobar.md

After adding Shamsi date to your contents, you can display Shamsi date in your posts by using {{ .Params.shamsidate }} in your templates. The default format of shamsi date is d M yyyy but you can change it by adding shamsiDateFormat configuration option to your website config file.

baseURL = "http://alireza.es"
title = "بلاگ علیرضا احمدی"
theme = "vivid"
...
shamsiDateFormat = "d MMMماه yyyy"
...
[indexes]
   topic = "topics"

These are the available formmating options:

yyyy, yyy, y     year (e.g. 1394)
yy               2-digits representation of year (e.g. 94)
MMM              the Persian name of month (e.g. فروردین)
MMI              the Dari name of month (e.g. حمل)
MM               2-digits representation of month (e.g. 01)
M                month (e.g. 1)
rw               remaining weeks of year
w                week of year
W                week of month
RD               remaining days of year
D                day of year
rd               remaining days of month
dd               2-digits representation of day (e.g. 01)
d                day (e.g. 1)
E                the Persian name of weekday (e.g. شنبه)
e                the Persian short name of weekday (e.g. ش)
A                the Persian name of 12-Hour marker (e.g. قبل از ظهر)
a                the Persian short name of 12-Hour marker (e.g. ق.ظ)
HH               2-digits representation of hour [00-23]
H                hour [0-23]
kk               2-digits representation of hour [01-24]
k                hour [1-24]
hh               2-digits representation of hour [01-12]
h                hour [1-12]
KK               2-digits representation of hour [00-11]
K                hour [0-11]
mm               2-digits representation of minute [00-59]
m                minute [0-59]
ss               2-digits representation of seconds [00-59]
s                seconds [0-59]
ns               nanoseconds
S                3-digits representation of milliseconds (e.g. 001)
z                the name of location
Z                zone offset (e.g. +03:30)

Learn more about formatting options on ptime repository.

Also, if you want to get help about command line options, run the following command:

hoor -h

How it works?

Due to the lack of plugin system in Hugo, there is no way to change date format in the build process. I approached a simple solution for fixing this problem. By running hoor command in your hugo site source code, Hoor will automatically finds all of your posts/pages, read the gregorian date and convert it to a Shamsi(Jalali) date string then add the result to the front matter list. Afterwards, you can use that string as a template variable.

So why shouldn't I generate that string manually, using a simple code editor?

Of course you can write it manually, but applying any change in date format would be a great pain in future, by using Hoor you can change date format of 50+ files in a few seconds while changing them manually would take so much longer. It's all about maintainability.

Issues

Found any issues? Create an issue in the issues page.

TODO

  • Add more tests

Credits

Hoor is built upon Hugo and ptime.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].