Back to articles
Using a Headless CMS with Angular and Analog Content Loaders
How-ToTools

Using a Headless CMS with Angular and Analog Content Loaders

via Dev.toBrandon Roberts

Analog provides a powerful content system out of the box. Drop some markdown files in the src/content folder, add some frontmatter, and you have a working blog. For many projects, this is all you need. The @analogjs/content package also allows you to pull posts from a headless CMS like Contentful, Sanity, or some other external source. This post shows you how to provide your own content loaders and keep your component the same using the custom content resource APIs. Understanding the Default Content System Before diving into custom loaders, let's understand how the default system works. Analog provides Resources that fetch content files and content using Angular Resources underneath. When you call contentFilesResource() , Analog returns an Angular resource containing an array of ContentFile objects: interface ContentFile < Attributes extends Record < string , any >> { filename : string ; slug : string ; content ?: string | object ; attributes : Attributes ; } Each content file has a fi

Continue reading on Dev.to

Opens in a new tab

Read Full Article
27 views

Related Articles