Skip to content

Commit

Permalink
fix external link + changes for circleci
Browse files Browse the repository at this point in the history
  • Loading branch information
wildcard committed Jan 12, 2020
1 parent 25e9f12 commit fe6febc
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
defaults: &defaults
docker:
- image: circleci/node:10.17.0
working_directory: ~/gatsby-starter-lumen
working_directory: ~/kobi.kadosh.me

jobs:
install:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
coverage/
.cache/
public/
npm-debug.log
Expand All @@ -7,4 +8,4 @@ npm-debug.log
.idea
gatsby-starter-lumen.iml
# Local Netlify folder
.netlify
.netlify
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module.exports = {
{
label: 'LevelUP MeetUp',
path: 'https://kobi.kadosh.me/levelUP',
external: true,
},
],
author: {
Expand Down
89 changes: 45 additions & 44 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,36 @@ module.exports = {
copyright: siteConfig.copyright,
disqusShortname: siteConfig.disqusShortname,
menu: siteConfig.menu,
author: siteConfig.author,
author: siteConfig.author
},
plugins: [
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/content`,
name: 'pages',
},
name: 'pages'
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/static/media`,
name: 'media',
},
name: 'media'
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'css',
path: `${__dirname}/static/css`,
},
path: `${__dirname}/static/css`
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'assets',
path: `${__dirname}/static`,
},
path: `${__dirname}/static`
}
},
{
resolve: 'gatsby-plugin-feed',
Expand All @@ -59,14 +59,15 @@ module.exports = {
`,
feeds: [
{
serialize: ({ query: { site, allMarkdownRemark } }) => allMarkdownRemark.edges.map((edge) => ({
...edge.node.frontmatter,
description: edge.node.frontmatter.description,
date: edge.node.frontmatter.date,
url: site.siteMetadata.site_url + edge.node.fields.slug,
guid: site.siteMetadata.site_url + edge.node.fields.slug,
custom_elements: [{ 'content:encoded': edge.node.html }],
})),
serialize:
({ query: { site, allMarkdownRemark } }) => allMarkdownRemark.edges.map((edge) => ({
...edge.node.frontmatter,
description: edge.node.frontmatter.description,
date: edge.node.frontmatter.date,
url: site.siteMetadata.site_url + edge.node.fields.slug,
guid: site.siteMetadata.site_url + edge.node.fields.slug,
custom_elements: [{ 'content:encoded': edge.node.html }]
})),
query: `
{
allMarkdownRemark(
Expand All @@ -93,10 +94,10 @@ module.exports = {
}
`,
output: '/rss.xml',
title: siteConfig.title,
},
],
},
title: siteConfig.title
}
]
}
},
{
resolve: 'gatsby-transformer-remark',
Expand All @@ -106,46 +107,46 @@ module.exports = {
{
resolve: 'gatsby-remark-katex',
options: {
strict: 'ignore',
},
strict: 'ignore'
}
},
{
resolve: 'gatsby-remark-images',
options: {
maxWidth: 960,
withWebp: true,
ignoreFileExtensions: [],
},
ignoreFileExtensions: []
}
},
{
resolve: 'gatsby-remark-responsive-iframe',
options: { wrapperStyle: 'margin-bottom: 1.0725rem' },
options: { wrapperStyle: 'margin-bottom: 1.0725rem' }
},
'gatsby-remark-autolink-headers',
'gatsby-remark-prismjs',
'gatsby-remark-copy-linked-files',
'gatsby-remark-smartypants',
'gatsby-remark-external-links',
],
},
'gatsby-remark-external-links'
]
}
},
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
'gatsby-plugin-netlify',
{
resolve: 'gatsby-plugin-netlify-cms',
options: {
modulePath: `${__dirname}/src/cms/index.js`,
},
modulePath: `${__dirname}/src/cms/index.js`
}
},
{
resolve: 'gatsby-plugin-google-gtag',
options: {
trackingIds: [siteConfig.googleAnalyticsId],
pluginConfig: {
head: true,
},
},
head: true
}
}
},
{
resolve: 'gatsby-plugin-sitemap',
Expand Down Expand Up @@ -174,9 +175,9 @@ module.exports = {
serialize: ({ site, allSitePage }) => allSitePage.edges.map((edge) => ({
url: site.siteMetadata.siteUrl + edge.node.path,
changefreq: 'daily',
priority: 0.7,
})),
},
priority: 0.7
}))
}
},
{
resolve: 'gatsby-plugin-manifest',
Expand All @@ -187,8 +188,8 @@ module.exports = {
background_color: '#FFF',
theme_color: '#446531',
display: 'standalone',
icon: 'static/kobi-kadosh-thumb-256.jpg',
},
icon: 'static/kobi-kadosh-thumb-256.jpg'
}
},
'gatsby-plugin-offline',
'gatsby-plugin-catch-links',
Expand All @@ -198,12 +199,12 @@ module.exports = {
options: {
postCssPlugins: [...postCssPlugins],
cssLoaderOptions: {
camelCase: false,
},
},
camelCase: false
}
}
},
'gatsby-plugin-flow',
'gatsby-plugin-optimize-svgs',
'gatsby-plugin-twitter',
],
'gatsby-plugin-twitter'
]
};
2 changes: 1 addition & 1 deletion src/components/Sidebar/Author/Author.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow strict
import React from 'react';
import { withPrefix, Link } from 'gatsby';
import { Link } from 'gatsby';
import Img, { FluidObject } from 'gatsby-image';
import styles from './Author.module.scss';

Expand Down
17 changes: 12 additions & 5 deletions src/components/Sidebar/Menu/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,29 @@ import styles from './Menu.module.scss';
type Props = {
menu: {
label: string,
path: string
path: string,
external?: boolean
}[]
};

const linkClasses = {
className: styles['menu__list-item-link'],
activeClassName: styles['menu__list-item-link--active']
};

const Menu = ({ menu }: Props) => (
<nav className={styles['menu']}>
<ul className={styles['menu__list']}>
{menu.map((item) => (
<li className={styles['menu__list-item']} key={item.path}>
<Link
{!item.external === true ? <Link
to={item.path}
className={styles['menu__list-item-link']}
activeClassName={styles['menu__list-item-link--active']}
{...linkClasses}
>
{item.label}
</Link>
</Link> : <a href={item.path} {...linkClasses}>
{item.label}
</a>}
</li>
))}
</ul>
Expand Down
5 changes: 5 additions & 0 deletions src/components/Sidebar/Menu/Menu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ describe('Menu', () => {
{
label: 'Item 1',
path: '/#1/'
},
{
label: 'External Item 1',
path: 'https://www.example.com',
external: true
}
]
};
Expand Down
11 changes: 11 additions & 0 deletions src/components/Sidebar/Menu/__snapshots__/Menu.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ exports[`Menu renders correctly 1`] = `
Item 1
</a>
</li>
<li
className="menu__list-item"
>
<a
activeClassName="menu__list-item-link--active"
className="menu__list-item-link"
href="https://www.example.com"
>
External Item 1
</a>
</li>
</ul>
</nav>
`;
1 change: 1 addition & 0 deletions src/hooks/use-site-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const useSiteMetadata = () => {
menu {
label
path
external
}
url
title
Expand Down

0 comments on commit fe6febc

Please sign in to comment.