Exam Area: Content Area 1 – Product Knowledge (15%)
Reference: https://docs.developers.optimizely.com/content-management-system/docs/search-engine-optimization
Optimizely CMS provides built-in SEO features:
| Property | Description |
|---|---|
PageName | Page name (Name in Page tree) |
PageURLSegment | URL slug of the page |
PageTitle | HTML <title> tag |
PageDescription | Meta description |
PageKeywords | Meta keywords |
PageVisibleInMenu | Show in navigation menu |
PagePeerOrder | Order in the page tree |
ExternalURL | Redirect URL |
CMS automatically generates friendly URLs based on:
/en/products/product-name/PageURLSegment property is auto-generated from PageName// URL segment is automatically generated from PageName
// Editors can change it in the "All Properties" view
// In code, use:
var url = _urlResolver.GetUrl(contentReference);
// In the base layout view
<link rel="canonical" href="@Request.GetDisplayUrl()" />
wwwroot/robots.txtIContentRepository to fetch all published pages// Get all published pages to generate a sitemap
var allPages = _contentRepository.GetDescendents(ContentReference.RootPage);
@* Layout view *@
<head>
<title>@Model.CurrentPage.PageTitle ?? Model.CurrentPage.PageName</title>
<meta name="description" content="@Model.CurrentPage.PageDescription" />
<meta name="keywords" content="@Model.CurrentPage.PageKeywords" />
@* Open Graph *@
<meta property="og:title" content="@Model.CurrentPage.PageTitle" />
<meta property="og:description" content="@Model.CurrentPage.PageDescription" />
</head>
// Permanent redirect (301)
// Use ExternalURL property or custom redirect rules
// In appsettings.json
{
"EPiServer": {
"CMS": {
"CanonicalUrlType": "Https"
}
}
}
@* In Layout, add hreflang for multilingual *@
@foreach (var lang in Model.AvailableLanguages)
{
<link rel="alternate"
hreflang="@lang.LanguageID"
href="@Url.ContentUrl(Model.CurrentPage.ContentLink, lang)" />
}
@* Add to View *@
<script type="application/ld+json">
{
"@@context": "https://schema.org",
"@@type": "Article",
"headline": "@Model.CurrentPage.PageTitle",
"description": "@Model.CurrentPage.PageDescription"
}
</script>
PageURLSegment)<title> tag? (PageTitle)PageVisibleInMenu)