惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
WordPress大学
WordPress大学
The Cloudflare Blog
云风的 BLOG
云风的 BLOG
博客园 - Franky
D
Docker
小众软件
小众软件
阮一峰的网络日志
阮一峰的网络日志
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Engineering at Meta
Engineering at Meta
MongoDB | Blog
MongoDB | Blog
U
Unit 42
M
MIT News - Artificial intelligence
B
Blog
GbyAI
GbyAI
C
Check Point Blog
P
Proofpoint News Feed
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
雷峰网
雷峰网
IT之家
IT之家
Google DeepMind News
Google DeepMind News
V
V2EX
Stack Overflow Blog
Stack Overflow Blog

CloudCannon Blog

Building with AI: Git-based vs headless vs traditional CMS CloudCannon + Astro: performance meets powerful content management Introducing the Astro Component Starter Introducing Jetstream — built on the Astro Component Starter Why we switched to the system font stack Redesigning CloudCannon’s docs with Diátaxis, Lume, and Pagefind Make content editing more visual: upgraded Editable Regions How Configuration Mode makes building editing interfaces easy Your hosting just got an upgrade (and a price cut) Custom testing domains for professional branding Keep your content consistent with input validation Managing multilingual content in CloudCannon Simplify team publishing with conflict resolution and domain tools Open Beta: Publishing Conflict Resolution Getting started with CloudCannon and Astro: Bookshop, components, and live editing Welcome to the CloudCannon Community! Omnichannel delivery is just marketing spin from API-based CMS companies Getting started with CloudCannon and Astro: Snippets and Collections Managing digital assets in CloudCannon: a guide to smart asset storage Understanding CloudCannon's branching workflows and Projects: a complete guide What is a static website? CloudCannon’s 2024 wrapped Getting started with CloudCannon and Astro: WYSIWYG blogging Jamstack vs. WordPress: reasons to make the change The top five static site generators for 2025 (and when to use them!) Free Jekyll themes for 2025: ten great community options Eleventy (11ty) vs. Hugo How to set up WYSIWYG editing with MkDocs Material The rise of static-first websites: why major brands are making the switch Watching your Core Web Vitals on Jamstack
Editing Content with Hugo Shortcodes: Built-in and Custom...
2022-11-03 · via CloudCannon Blog

You asked for it. We’ve done it. CloudCannon is the first CMS with full support and full integration for built-in and custom Hugo shortcodes — in our Visual, Content, and Source Editors. That’s a pretty big claim! What do we mean by this? Let’s take a look.

What are shortcodes? Direct link to this section

Hugo uses shortcodes — code snippets in content files — to get around the limitations of Markdown, while keeping the simplicity and ease of Markdown’s syntax. Shortcodes let developers consolidate templating into small, reusable snippets that can be embedded directly inside Markdown content.

Hugo ships with a set of predefined shortcodes, which we’ve integrated and configured for immediate use in CloudCannon’s Visual and Content Editors.

How to use Hugo’s built-in shortcodes in CloudCannon Direct link to this section

When you and your team members are working in CloudCannon’s Content Editor or Visual Editor, which provide two different WYSIWYG interfaces for Markdown content, you’ll be able to add a shortcode by simply clicking the ‘Snippet’ button at the top right of the editing pane. (More on Snippets later — we’ll be expanding this functionality across other SSGs in the coming weeks.)

WYSIWYG editor

From here you can select your Hugo shortcode.

Shortcode list

Within the shortcode interface itself, you’ll see all the available options to change the shortcode’s parameters.

Tweet example

This integration means that content editors and marketers will be able to create new shortcodes and edit existing shortcodes via an intuitive interface, without ever needing to work in source files.

If you’re a developer working locally, or via CloudCannon’s Source Editor view, simply call the shortcode in your Markdown content as you normally would — {{< shortcodename parameters >}} — and CloudCannon will include it in your Hugo build.

Here’s an example of how the gist shortcode looks in an example Markdown file:

## Heading text

Here's my Markdown content, with an example of the gist shortcode below.

{{< gist spf13 7896402 "img.html" >}}

The above shortcode, {{&lt; gist spf13 7896402 "img.html" &gt;}}, will embed the referenced code sample on your page.

You and your editors will now be able to see this gist shortcode, edit its parameters, or remove it via the Content Editor and Visual Editor views, where it appears as a component within the Markdown section of your page.

Configure your custom Hugo shortcodes in CloudCannon Direct link to this section

If you’ve been using Hugo for a while, you’re likely to have built up a library of your own custom shortcodes, stored in layouts/shortcodes/. If you’re working locally or within CloudCannon’s Source Editor, you can use them immediately.

To ensure that others can use or edit custom shortcodes from CloudCannon’s Content Editor or Visual Editor, you’ll need to add to your global CloudCannon configuration file. If you’re familiar with the logic behind configuring inputs within CloudCannon, this will be a relatively straightforward process. For more details, view our documentation on editing content with custom Hugo shortcodes.

Shortcodes for everyone Direct link to this section

By fully integrating both Hugo’s built-in shortcodes and your own custom Hugo shortcodes into CloudCannon’s intuitive Markdown editing views, CloudCannon help to surface one of Hugo’s core features for users with any level of technical ability.

We’ve always been focused on enhancing the editing experience for our users, and by integrating Hugo’s shortcodes fully into our Content Editor and Visual Editor we’re giving all our users a more efficient means of using templated content, and more control over their Hugo websites.

What’s next? Direct link to this section

We’ve been working on this feature for some time, because it’s important to our users. Over the coming months we’ll start to reveal more of the bigger picture for our Snippets feature, which will include full support and integration for shortcode equivalents in other static site generators (like Liquid tags in Jekyll and Eleventy), as well as full MDX support.

Our goal is to build the best Git-based CMS for your whole team, no matter which SSG you’re using. We’d love to hear what you think about our shortcode integration for your Hugo sites, and which features are still on your wishlist.

As always, feel free to reach out to our dev team in support with any questions or comments!