CMS pages
These components turn the items of a content provider into pages: lists, single articles, whole page layouts and the
metadata search engines read. They are in the Osirion.Blazor.Cms.Web package and read from the default provider
through IContentProviderManager, so register a content provider first (see
CMS Web components).
Most live in the Osirion.Blazor.Cms.Web.Components namespace. DocumentPage, HomePage and LandingPage live in
Osirion.Blazor.Cms.Components, next to the section components.
@using Osirion.Blazor.Cms.Web.Components
@using Osirion.Blazor.Cms.Components
Components
| Component | Use it for |
|---|---|
| ContentList | Blog indexes and category, tag, author and search pages, with pagination and list SEO. |
| ContentView | One item as an article: header, sanitized body, categories, tags, previous and next links. |
| LocalizedContentView | The same, with links to the item's translations. |
| ContentPage | A whole article page loaded by URL: breadcrumbs, sidebar, share links, related items. |
| ContentRenderer | Only the body, with code highlighting, inside a layout you build. |
| ArticlePage | A whole article page from one item: head metadata, hero, breadcrumbs, related articles and a sidebar. |
| DocumentPage | A whole documentation page: side navigation, table of contents, edit link and previous and next links. |
| HomePage | A home page from one item: hero, body, featured and recent items of the locale and a browse section. |
| LandingPage | A marketing page: a tall hero, the body in a section you size and style, features, testimonials, a call to action and your own content. |
| AboutPage | An about page from the item with the slug about, with room for author cards. |
| ContactPage | A contact page: a heading, an optional Markdown introduction and a contact form. |
| NotFoundPage | A page not found page with a way home, a search box and suggested pages. Answers 404. |
| SeoMetadataRenderer | Title, description, canonical URL, Open Graph, Twitter Card and JSON-LD in the page head. |
| Feeds and sitemap | /sitemap.xml, /feed.xml and /atom.xml endpoints. Available from 4.0. |
Choosing one
- Need a list? Use
ContentList; it also writes the list page's head metadata. - Need an article page with little code? ArticlePage (used by the example site) loads an
item by slug or URL and renders the hero, breadcrumbs, table of contents and head metadata.
ContentPageis the older, simpler layout and writes no head metadata. - Need a documentation page? Use DocumentPage. For the home, about, contact, landing and not found pages there are HomePage, AboutPage, ContactPage, LandingPage and NotFoundPage.
- Building your own layout? Combine
ContentVieworContentRendererwith aSeoMetadataRendererin<HeadContent>.
Shared behavior
- Everything renders under static SSR. Links are ordinary links, and no component here needs script; only code
highlighting in
ContentRendererloads Prism when the content has code blocks. - Content HTML is sanitized before it is written: the providers sanitize Markdown output when they load it, and
ContentView,LocalizedContentViewandContentRenderersanitize again, which covers custom providers and items you create in code. Widen the allow-list withAddOsirionHtmlSanitizerwhen your content needs a custom element. - Category and tag links default to
/category/{slug}and/tag/{slug};LocalizedContentView, and thereforeContentPage, puts the locale in front (/en/category/{slug}). Each component takes formatter parameters when your routes differ. - A page or view that renders a not-found state also answers HTTP 404 (
NavigationManager.NotFound()on .NET 10, the status code of the request on .NET 9):ArticlePage,AboutPage,HomePage,DocumentPage,ContentPage,ContentView,LocalizedContentViewandLandingPagewith aContentPath. The page components also take theirNotFound*andBackLink*parameters for that state and pass their SEO parameters on toSeoMetadataRenderer. ContentViewandLocalizedContentViewwrite the title as anh1; setHeadingLevelwhen you embed one in a page that has its own. Their images take thealttext from thefeatured_image_altentry ofcustom_fieldsin the front matter, and are decorative (emptyalt) without it.