sfc-utils 1.4.49 → 1.4.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/byline.mjs +1 -1
- package/components/topper2.mjs +26 -0
- package/package.json +1 -1
package/components/byline.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
moddateString,
|
|
8
8
|
} from './helpers/datehelpers.mjs'
|
|
9
9
|
|
|
10
|
-
const Byline = ({ meta, updateNote, updatePrefix }) => {
|
|
10
|
+
const Byline = ({ meta, updateNote, updatePrefix, ReplacementTime }) => {
|
|
11
11
|
const {
|
|
12
12
|
PROJECT: { AUTHORS, ISO_MODDATE, ISO_PUBDATE },
|
|
13
13
|
} = meta
|
package/components/topper2.mjs
CHANGED
|
@@ -348,6 +348,10 @@ const Topper2 = ({ settings, wcmData, mods }) => {
|
|
|
348
348
|
|
|
349
349
|
const wcmIdList = getWcmIdList(Image);
|
|
350
350
|
const TopperHtml = () => {
|
|
351
|
+
// Remove <a> tags from Title and Deck, links in h1/h2 are bad for SEO
|
|
352
|
+
Title = removeLinksFromText(Title)
|
|
353
|
+
Deck = removeLinksFromText(Deck)
|
|
354
|
+
|
|
351
355
|
switch (Topper_Style) {
|
|
352
356
|
case "full-screen":
|
|
353
357
|
let containerCss = isSlideshow(wcmIdList) ? topperStyles.topperContainerSlideshowFullScreen : topperStyles.topperContainerFullScreen;
|
|
@@ -588,6 +592,28 @@ const Topper2 = ({ settings, wcmData, mods }) => {
|
|
|
588
592
|
}
|
|
589
593
|
}
|
|
590
594
|
|
|
595
|
+
/** Removes html links from string */
|
|
596
|
+
const removeLinksFromText = (str) => {
|
|
597
|
+
// Matches to text with <a> tags
|
|
598
|
+
let reStr = "(<a | <a)(.*)(?=>)(.*)(<\/a>)";
|
|
599
|
+
let reEndStr = "(<\/a>)"
|
|
600
|
+
|
|
601
|
+
let re = RegExp(reStr, 'g');
|
|
602
|
+
let reEnd = RegExp(reEndStr, 'g')
|
|
603
|
+
|
|
604
|
+
let linkText = re.exec(str)
|
|
605
|
+
// If text does not contain links, return early
|
|
606
|
+
if (linkText === null) return str
|
|
607
|
+
|
|
608
|
+
let linkedText = linkText[0].split(reEnd)[0].split(">")[1].trim()
|
|
609
|
+
|
|
610
|
+
let textArr = str.split(re)
|
|
611
|
+
let preLink = (textArr.length > 2 || re.lastIndex === str.length) ? textArr[0].trim() : "";
|
|
612
|
+
let postLink = (textArr.length > 2 || re.lastIndex !== str.length) ? String(textArr.slice(-1)).trim() : "";
|
|
613
|
+
|
|
614
|
+
return `${preLink} ${linkedText} ${postLink}`
|
|
615
|
+
}
|
|
616
|
+
|
|
591
617
|
return (
|
|
592
618
|
<TopperHtml />
|
|
593
619
|
)
|