diff --git a/components/Footer.js b/components/Footer.js index f934b9f9..8dc08f5e 100644 --- a/components/Footer.js +++ b/components/Footer.js @@ -40,78 +40,18 @@ const Footer = (props) => { } return( - + - + - Should we send you a notification when new blogs are published?👇 - - - - - - - - - - { subscribedStatus !== undefined && subscribedStatus.error === true && '❌' } - { subscribedStatus !== undefined && subscribedStatus.error === false && '✅' } - { subscribedStatus !== undefined && subscribedStatus.message !== undefined && subscribedStatus.message } + Should we send you a notification when new blogs are published? +
+ {/* @TODO: Make this link dynamic */} + Then you can subscribe to newsletter here! It is just one click, and no spam! ❤️
diff --git a/components/Home/Blogcard.js b/components/Home/Blogcard.js index 7fb05a42..ddca6ba5 100644 --- a/components/Home/Blogcard.js +++ b/components/Home/Blogcard.js @@ -1,6 +1,7 @@ import { Box, Heading, Link as ChakraLink, Text } from "@chakra-ui/layout"; import Link from 'next/link'; import StripTags from "../../src/escaping/StripTags"; +import { prepareExcerpt } from "../../src/helper-functions"; const parseDate = (rawDate) => { @@ -41,7 +42,7 @@ export default function Blogcard({ data, styles, ...rest }) { {/* There wil also be an option to insert content if excerpt is not present. */} - {StripTags(excerpt)} + {prepareExcerpt(excerpt)} diff --git a/src/helper-functions/index.js b/src/helper-functions/index.js index 586bc4b8..f0e0b9d7 100644 --- a/src/helper-functions/index.js +++ b/src/helper-functions/index.js @@ -4,6 +4,7 @@ import humanFormat from 'human-format'; import TimeAgo from 'javascript-time-ago'; import en from 'javascript-time-ago/locale/en'; import _ from "lodash"; +import StripTags from "../escaping/StripTags"; TimeAgo.addLocale(en); @@ -95,3 +96,14 @@ export const doesSlugMatchesCustomPage = (slug) => { return pagesToExclude.includes(slug); } + +export const prepareExcerpt = (excerpt) => { + const regex = /

(.*?)<\/p>/s; + const match = excerpt.match(regex); + + if (match) { + excerpt = match[1]; + } + + return StripTags(excerpt); +} diff --git a/styles/globals.css b/styles/globals.css index 26a5f7ae..403479bb 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -19,12 +19,19 @@ a { } .notice a, +.footer a, .container a { color: #71e3ff; transition: color 1s, text-shadow 0.5s; } +.newsletter-subscribe a, +.notice a { + text-decoration: underline; +} + .notice a:hover, +.footer a:hover, .container a:hover { color: #b6fdff; }