sfc-utils 1.4.50 → 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.
@@ -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
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.4.50",
3
+ "version": "1.4.51",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",