From 6e655b6a6d6187f1451254d13f169d78b72a8daa Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sat, 29 Sep 2018 20:09:02 +0200 Subject: [PATCH 1/3] realeted posts based on tags --- README.md | 4 + ...2015-08-02-simple-tor-setup-on-mac-os-x.md | 2 +- src/components/atoms/Image.jsx | 8 ++ src/components/atoms/PostTitle.module.scss | 9 +- src/components/molecules/Featured.jsx | 4 +- src/components/molecules/PostMeta.jsx | 9 +- src/components/molecules/RelatedPosts.jsx | 120 ++++++++++++++++++ .../molecules/RelatedPosts.module.scss | 88 +++++++++++++ src/templates/Post.jsx | 15 ++- 9 files changed, 241 insertions(+), 18 deletions(-) create mode 100644 src/components/molecules/RelatedPosts.jsx create mode 100644 src/components/molecules/RelatedPosts.module.scss diff --git a/README.md b/README.md index b3a19230..7ae92662 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,10 @@ The whole [blog](https://kremalicious.com) is a React-based Single Page App buil ... +### Related Posts + +... + ### 🏆 SEO component Includes a SEO component which automatically switches all required `meta` tags for search engines, Twitter Cards, and Facebook OpenGraph tags based on the browsed route/page. diff --git a/content/posts/2015-08-02-simple-tor-setup-on-mac-os-x.md b/content/posts/2015-08-02-simple-tor-setup-on-mac-os-x.md index f3f936b3..6f696049 100644 --- a/content/posts/2015-08-02-simple-tor-setup-on-mac-os-x.md +++ b/content/posts/2015-08-02-simple-tor-setup-on-mac-os-x.md @@ -10,10 +10,10 @@ updated: 2018-07-11 00:52:46+02:00 featured: true tags: - - goodies - tutorial - tor - macos + - goodies coinhive: true --- diff --git a/src/components/atoms/Image.jsx b/src/components/atoms/Image.jsx index 3db63015..c9889c00 100644 --- a/src/components/atoms/Image.jsx +++ b/src/components/atoms/Image.jsx @@ -29,4 +29,12 @@ export const imageSizeDefault = graphql` } ` +export const imageSizeThumb = graphql` + fragment ImageFluidThumb on ImageSharp { + fluid(maxWidth: 200, maxHeight: 85, quality: 85, cropFocus: CENTER) { + ...GatsbyImageSharpFluid_withWebp_noBase64 + } + } +` + export default Image diff --git a/src/components/atoms/PostTitle.module.scss b/src/components/atoms/PostTitle.module.scss index e1a1edd3..5675f52e 100644 --- a/src/components/atoms/PostTitle.module.scss +++ b/src/components/atoms/PostTitle.module.scss @@ -27,15 +27,10 @@ @include ellipsis(); width: 100%; - text-align: center; color: $text-color; font-family: $font-family-base; font-size: $font-size-small; padding: ($spacer/4) 0; - max-width: 70%; - margin: -($spacer) auto $spacer auto; - - @media (min-width: $screen-sm) { - max-width: 50%; - } + margin-top: -($spacer); + margin-bottom: $spacer; } diff --git a/src/components/molecules/Featured.jsx b/src/components/molecules/Featured.jsx index 2d35de3c..8014677e 100644 --- a/src/components/molecules/Featured.jsx +++ b/src/components/molecules/Featured.jsx @@ -16,9 +16,7 @@ const query = graphql` title image { childImageSharp { - fluid(maxWidth: 300, maxHeight: 130, cropFocus: CENTER) { - ...GatsbyImageSharpFluid_withWebp_noBase64 - } + ...ImageFluidThumb } } } diff --git a/src/components/molecules/PostMeta.jsx b/src/components/molecules/PostMeta.jsx index e1a66d0d..0897e65f 100644 --- a/src/components/molecules/PostMeta.jsx +++ b/src/components/molecules/PostMeta.jsx @@ -3,17 +3,14 @@ import PropTypes from 'prop-types' import { Link } from 'gatsby' import Time from 'react-time' import slugify from 'slugify' -import PostLinkActions from '../atoms/PostLinkActions' import styles from './PostMeta.module.scss' const PostMeta = ({ post, meta }) => { - const { author, updated, tags, type, linkurl } = post.frontmatter - const { date, slug } = post.fields + const { author, updated, tags, type } = post.frontmatter + const { date } = post.fields return (