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

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
量子位
小众软件
小众软件
C
Cybersecurity and Infrastructure Security Agency CISA
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tenable Blog
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
T
Threat Research - Cisco Blogs
Latest news
Latest news
Spread Privacy
Spread Privacy
C
Cyber Attacks, Cyber Crime and Cyber Security
NISL@THU
NISL@THU
T
Tor Project blog
Hacker News: Ask HN
Hacker News: Ask HN
V2EX - 技术
V2EX - 技术
T
The Exploit Database - CXSecurity.com
博客园 - 三生石上(FineUI控件)
K
Kaspersky official blog
Cyberwarzone
Cyberwarzone
博客园 - 叶小钗
博客园 - 聂微东
Last Week in AI
Last Week in AI
爱范儿
爱范儿
腾讯CDC
博客园 - Franky
美团技术团队
J
Java Code Geeks
O
OpenAI News
L
Lohrmann on Cybersecurity
Simon Willison's Weblog
Simon Willison's Weblog
有赞技术团队
有赞技术团队
T
Threatpost
G
GRAHAM CLULEY
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
宝玉的分享
宝玉的分享
I
Intezer
N
News and Events Feed by Topic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
S
Security @ Cisco Blogs
Forbes - Security
Forbes - Security
N
News | PayPal Newsroom
Stack Overflow Blog
Stack Overflow Blog
Scott Helme
Scott Helme
H
Hacker News: Front Page
Cloudbric
Cloudbric

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 Understanding the difference between static, dynamic, and hybrid websites Looking for an alternative to Netlify CMS or Decap CMS? Designing components for your website editors: a CloudCannon case study Does my website look big in this? Six tips to lower your page weight Content is sacred — so own your revision history The eternal balancing act: load time vs. delay time Streamlined Headless Mode, Unified Configuration, and live data editing What is a headless CMS? Looking for a TinaCMS or Tina Cloud alternative? The ultimate guide to Hugo Sections Coming soon: Live config editing and data reloading Faster publishing workflows out now! Why information architecture matters for your website Website UX vs SEO: picking your battles Easily manage your multilingual Astro site in CloudCannon How you can optimize publishing workflows for your content team How you can optimize your CMS for SEO success How you can optimize your Content Editor for long-form articles How you can optimize your Visual Editor for page building Secure, swift, and stable: static sites for the financial sector Enhanced flexibility for teams with Custom Permissions Building static sites that scale The Inaugural 11ty International Symposium on Making Web Sites Real Good How to manage hundreds of connected websites with a Git-based headless CMS How we’re building CloudCannon for accessibility CloudCannon’s new editing improvements are here! Open Beta | New ways to collaborate on editing your websites Top 11 free Eleventy themes for 2024 Top 10 free Astro themes to use in 2024 Why choose a Git-based headless CMS over a monolithic DXP in 2024? Learning web development: a self-guided roadmap Partner Site of the Month: Blüthner Piano Centre, by Winteractive CloudCannon’s 2023 wrapup Update and visualize your branches with CloudCannon Projects What is a Git-based CMS and why you should use one CloudCannon secures SOC 2 certification The complete guide to growing your web development agency Automatically optimize your images with Eleventy Image and CloudCannon Share components and syndicate content with Site Mounting Partner Site of the Month: Cru Uncorked, by Ed Meehan New web component for responsive HTML tables Wrapping up HugoConf 2023 Partner Site of the Month: Van Dillen Antieke Bouwmaterialen, by Fulldev How to become a freelance web developer: a comprehensive guide Q3 2023: CloudCannon features and improvements 22 ways to deliver more value to your web development clients Partner Site of the Month: DC Gay Flag Football League, by Ed Cupaioli A new way to configure your CloudCannon sites CloudCannon — the official CMS partner of Eleventy Full CloudCannon support for Nuxt static sites Partner Site of the Month: Stadium Bike, by Insight Creative, Inc. HugoConf 2023, brought to you by CloudCannon DAM Support for Cloudflare R2 and DigitalOcean Spaces Eleventy (11ty) vs. Gatsby in 2023 – which SSG is best for you? How CloudCannon’s live editing works with Astro and Bookshop Partner Site of the Month: Fiducian, by Croissant & Baguette Eleventy (11ty) vs. Astro How to customize CloudCannon’s Client Sharing interface Let anyone, anywhere, edit your CloudCannon sites Top 23 free Astro themes for building out-of-this-world static sites in 2023 How Jampack optimizes our Eleventy website and improves performance Astro vs. Next.js CloudCannon.com is now built with Eleventy! Out-of-this-world support for all Astro users Introducing the CloudCannon Partner Program Full CloudCannon support for Gatsby Top 10 Free SvelteKit Themes for Building Lighting-Fast Static Sites in 2023 Enhanced CloudCannon support for Next.js users Upcoming CloudCannon Interface improvements (Open Beta) Creating sites, the Jamstack way
Let’s create a microblog with visual editing using Bookshop and Eleventy
2023-12-08 · via CloudCannon Blog

Visual editing is table stakes for a modern content management workflow. Using CloudCannon, it’s straightforward to add visual editing to your project using the same workflow your development team already loves.

Visual editing empowers editors to feel confident when building content inside of the CMS and having that content look identical when it is pushed to production.

To get visual editing up and running with CloudCannon, we’ll use a plugin called Bookshop. In the guides section of the CloudCannon documentation you can find a section dedicated to Bookshop, with guides specifically for Astro and Eleventy.

Let’s make a Microblog Direct link to this section

In this post we’re going to go through the minimum viable steps to add Bookshop Visual Editing to an Eleventy Microblog (think something akin to Tumblr).

You can head over to GitHub to read through the final source code of the Microblog project. Feel free to fork the repository and deploy your own version to CloudCannon to try this out for yourself!

live demo of the final product is also available (with a few sample posts). Editors can add any arbitrary HTML content to the blog and the project includes pages for the content stream, individual posts, tags, and also on-page search (via Pagefind).

Set up Bookshop Direct link to this section

Scaffolding Direct link to this section

To create the initial Bookshop component files and folder structure, you can run the following command to populate the _component-library folder:

npx @bookshop/init --new _component-library --framework eleventy

Installation Direct link to this section

Next, let’s install our Bookshop dependencies. You can install everything you need for Bookshop with this command:

npm install --save-dev --save-exact @bookshop/eleventy-bookshop @bookshop/sass @bookshop/generate @bookshop/eleventy-engine npm-run-all
  • @bookshop/eleventy-bookshop to add Bookshop shortcodes to Eleventy.

  • @bookshop/sass to compile our Sass stylesheets.

  • @bookshop/generate @bookshop/eleventy-engine to enable Live Editing features on CloudCannon (these are not necessary for local development)

  • npm-run-all: (not Bookshop-specific) used during local development to run Eleventy and our Sass compiler side-by-side

Eleventy Configuration Direct link to this section

Next we’ll want to add Bookshop’s Eleventy plugin to our Eleventy configuration file (likely .eleventy.js or eleventy.config.js) the same as you would any other Eleventy plugin.

const pluginBookshop = require("@bookshop/eleventy-bookshop");

module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(pluginBookshop({
bookshopLocations: ["_component-library"]
}));
};

The bookshopLocations configuration property must match the folder name specified in our scaffolding command (npx @bookshop/init …) above.

Compiling Sass Direct link to this section

We’ll also need to compile our Bookshop component styles, which you can do with the bookshop-sass command in these handy npm script additions to your package.json:

{
"scripts": {
"build:style": "bookshop-sass --bookshop _component-library --output _site/public/bookshop.css",
"dev:style": "npm run build:style -- --watch",
"dev:content": "npx @11ty/eleventy --serve --quiet",
"start": "run-p dev:*"
}
}

Now we simply run npm start to start Eleventy’s local development server and Bookshop is running locally!

CloudCannon Build Hooks Direct link to this section

Finally, we’ll add two CloudCannon build hooks to run our Bookshop integrations on the CloudCannon servers. We will create two files: .cloudcannon/prebuild and .cloudcannon/postbuild.

.cloudcannon/prebuild:

#!/usr/bin/env bash

npm install
npm run build:style

.cloudcannon/postbuild:

#!/usr/bin/env bash

npx @bookshop/generate

Using Bookshop Direct link to this section

Now that our setup is complete we can move on to the fun part: creating Bookshop components. At time of writing, our Microblog project has three Bookshop components: text, code, and link.

You can view the source code for our finished Microblog components for codelink, and text.

The simplest of these is the text component which holds on to no more than plain ol’ HTML content. Each Bookshop component can be represented in three files and text is no exception:

  • text.bookshop.yml for CloudCannon specific configuration (including input types).

  • text.eleventy.liquid for Liquid templating syntax for the component.

  • text.scss for component styles.

When we make changes to the HTML content in a text component in the CloudCannon interface, the visual rendering of the component will be updated in real time in the visual editor.

If you’d like to see a preview of how the visual editing experience looks and behaves, skip to 0:46 in this video on YouTube (or watch below).

You can mix and combine these Bookshop components together to create a post on the blog and the values for each of the component instances are serialized as content_blocks in the template’s front matter (view a sample post).

Works With Web Components Direct link to this section

Perhaps more interestingly, the link Bookshop component uses the <browser-window> web component and is editable without any configuration or introspection into the web component’s code — and this example demonstrates re-rendering compatibility with Shadow DOM web components too.

Any changes to the link URL are automatically reflected in the web component and the screenshot with favicon are updated accordingly.

Current Limitations Direct link to this section

Shortcodes are not supported in Bookshop components. Guarding the shortcode with env_bookshop_live is not yet a viable workaround. This is a Liquid limitation with parsing unknown shortcode names that we hope to fix soon. Try to switch your shortcode to use a filter instead and it will work fine.

That’s it! Direct link to this section

We now have a visual editing interface for our Microblog. Editors can now add or edit entries easily and predictably — but there is more! On the full Bookshop guide you can learn more about data binding, live editing fallbacks, custom plugins, preview thumbnails, and the component playground (everybody loves a style guide!).

Poster image photo by Ivo Rainha.