Files
datacontroller.io/src/templates/shared/getDescription.ts
T
Unknown 8a10d127c1
publish / Build-and-publish (push) Successful in 13m32s
feat: feed feature, typescript, remove google, fix errs & warns
2026-07-17 22:22:29 +01:00

14 lines
365 B
TypeScript

const extractContent = (s: string): string => {
if (typeof document !== `undefined`) {
const span = document.createElement('span')
span.innerHTML = s
return span.textContent || span.innerText
}
return s
}
const getDescription = (content: string): string => {
return extractContent(content).slice(0, 100) + '...'
}
export default getDescription