Sitemap Config
The sitemap_config
object defines the settings for generating sitemaps for different sections of a website, such as pages and blogs. This setup specifies which URLs should be included in the sitemap, their priorities, update frequencies, and additional filtering logic.
Structure of sitemap_config
Each Section Includes:
Property Name | Type | Description |
---|---|---|
sitemapName |
string |
The name for the sitemap (optional). |
status_field_id |
number |
A field ID used to determine the inclusion status of items in the sitemap. |
frequency |
string |
The default update frequency (e.g., "weekly", "monthly"). |
priority |
number |
The default priority for URLs (usually between 0.0 and 1.0). |
cases |
array |
A list of specific rules for individual routes or patterns. |
filter |
function |
A function to filter items based on their fields (e.g., only active items). |
export const sitemap_config = {
pages: {
sitemap: {
status_field_id: number,
frequency: 'string',
priority: number,
sitemapName: 'string',
cases: [
{
case: 'string',
priority: number,
frequency: 'string'
},
{
case: 'string',
priority: number,
frequency: 'string'
},
{
case: 'string',
priority: number,
frequency: 'string'
}
],
filter: function(items) {
const status_field_id = this.status_field_id;
return items.filter(item => {
const field = item.fields.find(field => field.field_id == status_field_id);
if(field) {
return field.field_value == 1;
}
return false;
});
}
}
},
};