SiteMapService Class
Constructor
SiteMapService
-
context
Parameters:
-
context
Object-
ts
TemplateService -
ls
Localization -
articleService
ArticleServiceV2 -
pageService
PageService -
site
StringThe site UID
-
onlyThisSite
Boolean -
templatePath
String -
urlTemplatePath
String -
[supportedLocales]
Array optional
-
Item Index
Methods
- _serializeItems
- createAlternateLinks static
- formatGetResults static
- get
- getAndSerialize
- getForArticles
- getForContent
- getForPages
- getForSections
- getLastModDateStr static
- onPostLoad static
- paddedNumStr static
- register static
- serializeLocaleLink static
- toXml
- unregister static
Properties
Methods
_serializeItems
-
items
-
cb
Parameters:
-
items
Array -
cb
Function
createAlternateLinks
-
item
-
currentLocale
-
locales
-
hostname
Takes a site map item and inspects its localized property. If it evaluates to TRUE then the XML elements are generated that match the allowed locales
Parameters:
-
item
Object -
currentLocale
String -
locales
Array -
hostname
String
Returns:
formatGetResults
-
cb
Returns a function that accepts two parameters. The first is an error, if exists, and the second is an array of arrays. The returning function, when executed, reduces the array of arrays down to a single array. NOTE: results are not deduped.
Parameters:
-
cb
Function
Returns:
get
-
[options]
-
cb
Parameters:
-
[options]
Object optional -
cb
Function
getAndSerialize
-
[options]
-
cb
Parameters:
-
[options]
Object optional -
cb
Function
getForArticles
-
context
-
cb
Parameters:
-
context
Object -
cb
Function
getForContent
-
context
-
options
-
cb
Parameters:
-
context
Object -
options
Object -
cb
Function
getForPages
-
context
-
cb
Parameters:
-
context
Object -
cb
Function
getForSections
-
context
-
cb
Parameters:
-
context
Object -
cb
Function
getLastModDateStr
-
date
Formats date objects to a string in the format of: YYYY-MM-DD
Parameters:
-
date
Date
Returns:
onPostLoad
-
options
-
cb
Returns a function that processes site map items. It calculates the full URL for the item as well as setting the weight and indicating if the items is localized. The returned function accepts two parameters. The first is an error object, if exists. The second is an Array of objects.
Parameters:
-
options
Object-
urlPrefix
String -
weight
Decimal -
localized
Boolean
-
-
cb
Function
Returns:
paddedNumStr
-
num
Converts the provided number to a string. If the number is less than 10 it is prefix with a '0'.
Parameters:
-
num
Integer
Returns:
register
-
type
-
callback
Registers an item provider. The callback should take two parameters. The first is a context object. The second is callback function.
Parameters:
-
type
String -
callback
Function
Returns:
serializeLocaleLink
-
context
Takes the provided relationship, locale, and URL to generate an XML element to represent the alternate link for a site map
Parameters:
-
context
Object-
relationship
String -
locale
String -
url
String
-
Returns:
toXml
-
items
-
[options]
-
cb
Parameters:
-
items
Array -
[options]
Object optional -
cb
Function
unregister
-
type
Unregisters an item provider from the site map service
Parameters:
-
type
String
Returns:
Properties
DEFAULT_TEMPLATE
String
private
static
DEFAULT_URL_TEMPLATE
String
private
static
onlyThisSite
Boolean
site
String
SITE_MAP_REGISTRY
Object
private
static
siteMapRegistry
Object
The instance of the registry to pull from. Initializes based off of the global configuration
supportedLocales
Array
The locales that are supported for the site as an array of strings