Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 39x 99x 1x 2x 1x 1x 1x 3x 3x 1x 2x 1x 1x | import { ContentPagelet } from 'ish-core/models/content-pagelet/content-pagelet.model';
import { SeoAttributesData } from './seo-attributes.interface';
import { SeoAttributes } from './seo-attributes.model';
export class SeoAttributesMapper {
static fromData(data: SeoAttributesData): SeoAttributes {
if (data) {
return {
title: data.metaTitle,
description: data.metaDescription,
robots: data.robots?.join(', '),
};
}
}
static fromCMSData(data: ContentPagelet): SeoAttributes {
if (data) {
const robots = [
data.configurationParameters?.RobotsNoIndex === 'true' ? 'noindex' : 'index',
data.configurationParameters?.RobotsNoFollow === 'true' ? 'nofollow' : 'follow',
].join(', ');
let title: string;
let description: string;
if (data.configurationParameters?.MetaInfo) {
(data.configurationParameters?.MetaInfo as string).split(';').forEach(entry => {
const keyValue = entry.split('=');
if (keyValue[0] === 'metaTitle') {
title = keyValue[1];
} else if (keyValue[0] === 'metaDescription') {
description = keyValue[1];
}
});
}
return { title, description, robots };
}
}
}
|