Sitecore Constants

I have seen a lot of projects where developers create constants or hardcode things that do not need to be hardcoded. This post will serve as an example so that developers are aware of the constant values that already come with the Sitecore binaries. I will not include all the constants since there are a lot, but I will go over the most important ones. These constants have been tested with Sitecore 9.1:

  • Sitecore.Constants: 
    • AnonymousUserName = "Anonymous" 
    • AshxExtension = "ashx"
    • AspxExtension = "aspx"
    • ContentPath = "/sitecore/content"
    • CoreDatabaseName = "core"
    • DefaultAspNetSessionIdCookieName = "ASP.NET_SessionId"
    • DefaultCulture = "en-US"
    • EmailRegExp = "^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$"
    • EveryoneRoleName = "Everyone"
    • GuidLength = 38
    • MediaLibraryPath = "/sitecore/media library"
    • MediaRequestPrefix = "-/media/"
    • MinimalPageEditorRoleName = "sitecore\\Sitecore Minimal Page Editor"
    • ModulesShellSiteName = "modules_shell"
    • PlaceholderSettingsPath = "/sitecore/layout/placeholder settings"
    • ShellSiteName = "shell"
    • SitecoreDictionaryRootPath = "/sitecore/system/Dictionary"
    • SitecorePath = "/sitecore"
    • SitecoreShellPath = "/sitecore/shell"
    • SitecoreUserProfilePath = "/sitecore/system/Settings/Security/Profiles"
    • StandardValuesItemName = "__Standard Values"
    • LaunchPadId = "{6B846FBD-8549-4C91-AE6B-18286EFE82D2}"
  • Sitecore.FieldIDs
    • ArchiveDate = The ID of the 'Archive date' field
    • BaseTemplate = The ID of the 'Base template' field
    • Created = The ID of the 'Created' field
    • CreatedBy = The ID of the 'Created by' field
    • DefaultWorkflow = The ID of the 'Initial workflow' field
    • DisplayName = The ID of the 'DisplayName' field
    • EnableLanguageFallback = The ID of the 'Enable Language Fallback' field from 'Template field' template
    • FallbackLanguage = The ID of the 'Fallback Language' field from 'Language' template.
    • Presentation = The ID of the 'Presentation' field
    • PublishDate =The ID of the 'Publish' field
    • Renderers = The ID of the 'Renderers' field
    • LayoutField = The ID of the 'LayoutField' field
    • StandardValues = The ID of the 'StandardValues' field
    • UpdatedBy = The ID of the 'Updated by' field
    • Updated = The ID of the 'Updated' field
    • Workflow = The ID of the 'Workflow' field
    • WorkflowState = The ID of the 'Workflow state' field
  • Sitecore.ItemIDs
    • AnonymousUser = The Anonymous user ID
    • ContentRoot = The ID of "/sitecore/content"
    • DefaultRibbon = The ID of "/sitecore/content/Applications/Content Editor/Ribbons/Ribbons/Default"
    • DevicesRoot = The ID of "/sitecore/layout/Devices"
    • Dictionary = The ID of "/sitecore/system/Dictionary"
    • EveryoneRoleID = The ID of the 'Everyone' role
    • LanguageRoot = The ID of the '/sitecore/system/language'
    • LayoutRoot = The ID of "/sitecore/layout"
    • Layouts = The ID of "/sitecore/layout/layouts"
    • MediaLibraryRoot = The ID of "/sitecore/media library"
    • Null = The Null ID (new ID("{00000000-0000-0000-0000-000000000000}"))
    • PlaceholderSettingsRoot = The ID of "/sitecore/layout/Placeholders"
    • RootID = The ID of the Sitecore root item
    • Shell = The ID of the /sitecore/content/System/Shell item in the core database
    • SystemRoot = The ID of "/sitecore/system"
  • Sitecore.CachePrefix
    • ClientData = "SC_CLIDAT_"
    • CoreItem = "SC_CORITM_"
    • DatabaseCache = "SC_DB_"
    • DomainUser = "SC_USR_"
    • Html = "SC_HTML_"
    • IndexCache = "SC_INDEX_CACHE_"
    • ItemDefinition = "SC_ITMDEF_"

Comments