added truncate feature to description function
This commit is contained in:
parent
ac7d2b3bd9
commit
8b74ed680d
1 changed files with 6 additions and 1 deletions
|
@ -6,7 +6,12 @@ function determineOgTitle (storedTitle, defaultTitle) {
|
|||
};
|
||||
|
||||
function determineOgDescription (storedDescription, defaultDescription) {
|
||||
return ifEmptyReturnOther(storedDescription, defaultDescription);
|
||||
const length = 200;
|
||||
let description = ifEmptyReturnOther(storedDescription, defaultDescription);
|
||||
if (description.length >= length) {
|
||||
description = `${description.substring(0, length)}...`;
|
||||
};
|
||||
return description;
|
||||
};
|
||||
|
||||
function ifEmptyReturnOther (value, replacement) {
|
||||
|
|
Loading…
Reference in a new issue