Shortcodes only for markdown?

Hey guys,

If i decide to write my content in raw html, i cannot use shortcodes?

Currently this is true.

But there is a TODO in the code and an open GitHub issues about letting html having shortcode support.

I believe it’s up to @spf13 … it’s easy to implement.

See

This would be a very welcomed feature.

In my particular case I have created a drag and drop content builder which writes the generated html file to the content directory. Instead of generating the html for the shortcode types (images, calendar, etc) inside the content file i would like that only their shortcodes are used and hugo will process them.

If any shortcode’s html needs to be changed all i need to do is modify the shortcode html in the hugo shortcode directory rather than regenerating all content files through the builder with the newly applied changes.

Can anyone confirm that changing the file extension to .md would be enough to serve this purpose?

Thanks

I can confirm that changing the file extension to .md and putting in raw html works. I’m still wondering if this is the right solution though or will something break depending on what content is entered.

The md files will get passed through Blackfriday … which is suboptimal in this case.

Shortcodes are not available in templates either I’m guessing since they are written in html correct?

Any chance these 2 options are in the works?

  1. Shortcodes in html content files
  2. Shortcodes in template files

…or perhaps there is another solution to my issue.

Basically,I need the user who will be editing the content of his website to be able to customize what is in the list.html file with the same ease of use he has when adding regular content.

For example: The user creates a blog but would like to add a banner image above the list of posts. Currently this doesn’t look possible unless he modifies the html itself in the within the section list.html file.

Any way around this?

Thanks

  1. Will possibly happen. Up to @spf13
  2. Will most likely never happen; that wasn’t why shortcodes were built

Is it true also if one uses reST/Asciidoc(tor) ?

No, both the reST and the Asciidoc handler should be OK re shortcodes.