Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: jinja shortcode tmpl? (seems to only work using mako) #2528

Closed
Fuzzwah opened this issue Oct 12, 2016 · 3 comments
Closed

question: jinja shortcode tmpl? (seems to only work using mako) #2528

Fuzzwah opened this issue Oct 12, 2016 · 3 comments

Comments

@Fuzzwah
Copy link

Fuzzwah commented Oct 12, 2016

The shortcodes template exmaple shows using jinja2 in the template file:

https://getnikola.com/extending.html#template-based-shortcodes

I have created a file shortcodes/image.tmpl and am trying to use the shortcode in an .rts file:

{{% image src=https://farm1.staticflickr.com/138/352972944_4f9d568680.jpg %}}

However I can't get jinja2 templates to work. Example:

<img class="img-responsive img-thumbnail img-rounded" style="margin-bottom: 10px" src="{{src}}">

However it works fine if I use mako style templating:

<img class="img-responsive img-thumbnail img-rounded" style="margin-bottom: 10px" src="${src}">

Is there something that I'm missing?

@Fuzzwah
Copy link
Author

Fuzzwah commented Oct 12, 2016

I now notice that the handbook only talks about mako. Bums me out that jinja2 used to be supported too (as I have experience with jinja2 but mako is new to me... seems similar enough that it won't be hard to get my head around, but I'm using jinja2 for other templating on the same site already).

@Kwpolska
Copy link
Member

Kwpolska commented Oct 12, 2016

On Tue, Oct 11, 2016 at 08:36:05PM -0700, Fuzzwah wrote:

I now notice that the handbook only talks about mako. Bums me out that jinja2 used to be supported too (as I have experience with jinja2 but mako is new to me... seems similar enough that it won't be hard to get my head around, but I'm using jinja2 for other templating on the same site already).

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#2528 (comment)

Jinja2 templates are still supported. Theming documentation still mentions
them, and we still ship and support base-jinja and bootstrap3-jinja.
Template-based shortcodes use the same template system your current theme uses.
So if you want Jinja2, make sure you're using a Jinja2-based theme.

Chris Warrick https://chriswarrick.com/
PGP: 5EAAEA16

@ralsina
Copy link
Member

ralsina commented Oct 12, 2016

@Fuzzwah like @Kwpolska said, to use jinja shortcuts, use a jinja theme, and it will work. The docs say more about Mako because it's the one I use, and I wrote most of those docs :-)

Jinja is just as much a 1st-class citizen as Mako, we have no mako-specific features anywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants