mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-01-22 17:30:00 +00:00
7aed7e3b90
* Added avoid flag text to meta descriptions * Moved meta description logic to a shortcode * Fixing nunjucks syntax error in base template head Co-authored-by: Oscar <ovlb@users.noreply.github.com>
17 lines
414 B
JavaScript
17 lines
414 B
JavaScript
module.exports = function(preview, flag = {}) {
|
|
const initialCap = function(text) {
|
|
return `${text[0].toUpperCase()}${text.slice(1)}`;
|
|
};
|
|
|
|
if (flag && flag.level === 'avoid') {
|
|
if (flag.text) {
|
|
return `${initialCap(
|
|
flag.level
|
|
)}: ${flag.text.toLowerCase()}. ${initialCap(preview)}`;
|
|
}
|
|
return `${initialCap(flag.level)}: ${preview}`;
|
|
}
|
|
|
|
return initialCap(preview);
|
|
};
|