mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
Add dateFormat template function
This is the implementation of the proposal at #235 and http://discuss.gohugo.io/t/parsing-dates-in-templates/603/3
This commit is contained in:
@@ -391,6 +391,11 @@ Replace all occurences of the search string with the replacement string.
|
||||
|
||||
e.g. `{{ replace "Batman and Robin" "Robin" "Catwoman" }}` → "Batman and Catwoman"
|
||||
|
||||
### dateFormat
|
||||
Converts the textual representation of the datetime into the other form or returns it of Go `time.Time` type value. These are formatted with the layout string.
|
||||
|
||||
e.g. `{{ dateFormat "Monday, Jan 2, 2006" "2015-01-21" }}` →"Wednesday, Jan 21, 2015"
|
||||
|
||||
### highlight
|
||||
Take a string of code and a language, uses Pygments to return the syntax highlighted code in HTML. Used in the [highlight shortcode](/extras/highlighting).
|
||||
|
||||
|
Reference in New Issue
Block a user