
























In my previous article and video, we explored the initial setup of an Astro site using CloudCannon, working with the BigSpring Light Astro theme and configuring the WYSIWYG Content Editor. We set up schemas for blog posts and learned how to manage content through CloudCannon’s intuitive interface. Now, let’s take our implementation further by adding advanced features and improving our site’s structure.
We'll build on that foundation by implementing Snippets for complex content components and reorganizing our Collections for better maintainability. We’ll also explore how to make your theme more flexible and editor-friendly while maintaining the power of Git-based content management.
First, let’s fix our image paths configuration. Instead of using the default public/uploads directory, we’ll set our image path to public/images in the global site config. This change requires:
To ensure consistent dependency management across the project, we also removed package-lock.json from our .gitignore file. This change helps guarantee that all developers working on the project use the same package versions.
To improve our content organization, we consolidated several individual Collections into a single pages Collection. This refactoring involved:
config.ts to accommodate all page typesThe new structure makes the content more manageable while maintaining the flexibility to handle different page types.
To enable complex HTML components within markdown content, we replaced auto-import with Bookshop, CloudCannon’s component building system. Here’s how we set it up:
Because Astro requires MDX, we also converted relevant .md files to .mdx to support component usage within content files.
To make Snippets editable in the CloudCannon interface, we added Snippet configurations to the CloudCannon config file. For example, we created a button Snippet with:
label, link, style, rel)text, url, select) for each propertystyle (outline, primary) and rel (follow, nofollow)This configuration allows content editors to easily add and customize buttons through the Content Editor, expanding upon the editing capabilities we set up in our previous tutorial.
In upcoming videos and articles, I’ll cover:
srcsetThis refactoring and enhancement work builds upon our initial setup to create a more robust and user-friendly Astro theme in CloudCannon. By combining the power of Git-based content management with features like Snippets and organized Collections, we’re creating a more efficient workflow for both developers and content editors.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。