mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
Add md5 and sha1 template funcs
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
be3519fac0
commit
94c3825e5b
@@ -595,6 +595,33 @@ CJK-like languages.
|
||||
```
|
||||
|
||||
|
||||
### md5
|
||||
|
||||
`md5` hashes the given input and returns its MD5 checksum.
|
||||
|
||||
```html
|
||||
{{ md5 "Hello world, gophers!" }}
|
||||
<!-- returns the string "b3029f756f98f79e7f1b7f1d1f0dd53b" -->
|
||||
```
|
||||
|
||||
This can be useful if you want to use Gravatar for generating a unique avatar:
|
||||
|
||||
```html
|
||||
<img src="https://www.gravatar.com/avatar/{{ md5 "your@email.com" }}?s=100&d=identicon">
|
||||
```
|
||||
|
||||
|
||||
### sha1
|
||||
|
||||
`sha1` hashes the given input and returns its SHA1 checksum.
|
||||
|
||||
```html
|
||||
{{ sha1 "Hello world, gophers!" }}
|
||||
<!-- returns the string "c8b5b0e33d408246e30f53e32b8f7627a7a649d4" -->
|
||||
```
|
||||
|
||||
|
||||
|
||||
## URLs
|
||||
|
||||
### absURL, relURL
|
||||
|
Reference in New Issue
Block a user