How do I enable template functions?

Hello, I’ve tried to use template functions, but do I need enable something for templating functions? Looks like templating doesn’t work for me.
like for example {{ "cat" | pluralize }} doesn’t work for me, it just prints {{ “cat” | pluralize }}

I’d like use lately added emojify functions, e.g. {{ "I :heart: Hugo" | emojify }} but doesn’t work for me, just prints this to text.

I have Hugo Static Site Generator v0.16-DEV BuildDate: 2016-03-13T08:10:03+01:00

Thanks!

What file are you putting that in?

Template syntax doesn’t work in content files – you will have to look into shortcodes if you need that.

Here https://gohugo.io/extras/shortcodes/ ?
I dont see there shortcodes for emojify as well and looks like it doesn’t work for me.

How do I use emojis in content files then? Or does theme need support it first? I’m using Air now.

Thanks! :slightly_smiling:

If you’re running the latest Hugo 0.16 DEV you can enable emoji in site config:

enableemoji: true

Then you can emoji all you want in the content files. :smile:

:this_is_the_syntax: put smile and beer etc. inside colons.

Well, I did it at first, in config.toml
enableEmoji = true but didn’t play a game in content files

shot from generated content file

What is the output of hugo version?

> hugo version Hugo Static Site Generator v0.16-DEV BuildDate: 2016-03-13T08:10:03+01:00

Not sure how you built this, but if you don’t see the emojis it must mean that you are not on the current version. So du a go get -u or whatever and try to build again.

can I output hugo version in built content files somehow?

That doesn’t help. You can try to build Hugo with make:

make
go build -ldflags "-X github.com/spf13/hugo/hugolib.CommitHash=`git rev-parse --short HEAD 2>/dev/null` -X github.com/spf13/hugo/hugolib.BuildDate=`date +%FT%T%z`" -o hugo main.go
➜  hugo git:(master) hugo version
Hugo Static Site Generator v0.16-DEV-3A2A4C3 BuildDate: 2016-03-15T00:00:14+01:00

This will include the Git commit hash.

well, it was built from commit 989c7487ebe369f3cdfab4b654267e5949b92414
your command didn’t work for me, and make just outputs same -dev

I can try go get -u newer one if so.

This is strange. Anyway, looks like this version should have emoji support? or how do I build last one? Or this looks like some go cache?

Any further debug steps?

wao@astrid~/L/g/s/g/s/hugo> make
go build -ldflags “-X github.com/spf13/hugo/hugolib.CommitHash=git rev-parse --short HEAD 2>/dev/null -X github.com/spf13/hugo/hugolib.BuildDate=date +%FT%T%z” -o hugo main.go
wao@astrid~/L/g/s/g/s/hugo> hugo version
Hugo Static Site Generator v0.16-DEV BuildDate: 2016-03-13T08:10:03+01:00
wao@astrid~/L/g/s/g/s/hugo> git rev-parse --short HEAD
3a2a4c3

deleted pkg, it was cache, but didn’t solve it.

hugo version Hugo Static Site Generator v0.16-DEV-3A2A4C3 BuildDate: 2016-03-15T00:47:07+01:00
emojis still doesnt works.
Any idea?

No, my best guess you have different binary fooling you somewhere. It works fine for me – you should wait for the release, then.

@bep please update the post, it’s enableEmoji, not enableemoji

OP says they already tried that though.

FWIW: I downloaded the OSX binary a while ago (Hugo Static Site Generator v0.16 BuildDate: 2016-06-06T14:29:38+02:00) but didn’t work, Pulled out a few hairs trying to get the elusive emoji’s to manifest.

Building Hugo Static Site Generator v0.17-DEV BuildDate: 2016-08-30T23:36:15+02:00 made them appear. :grinning:

L