diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5b356f4a..ee13dfa4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,31 +7,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Set Node Version uses: actions/setup-node@v1.4.2 with: node-version: 14 - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Check Cache - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - name: Install deps run: yarn --frozen-lockfile - if: steps.yarn-cache.outputs.cache-hit != 'true' - - name: Lint run: yarn lint - - name: Typecheck run: yarn typecheck diff --git a/next.config.js b/next.config.js index 39f8547c..a5e8e21f 100755 --- a/next.config.js +++ b/next.config.js @@ -321,6 +321,9 @@ module.exports = withFonts( jsconfigPaths: true, trailingSlash: true, }, + env: { + FATHOM_ID: 'EPNTIXUM', + }, redirects, pageExtensions: ['js', 'ts', 'tsx', 'md', 'mdx'], webpack: (config, options) => { diff --git a/public/images/og_image.png b/public/images/og_image.png new file mode 100644 index 00000000..0293ed9b Binary files /dev/null and b/public/images/og_image.png differ diff --git a/src/common/hooks/use-fathom.ts b/src/common/hooks/use-fathom.ts index e4c8c5d9..abe8a267 100644 --- a/src/common/hooks/use-fathom.ts +++ b/src/common/hooks/use-fathom.ts @@ -2,23 +2,20 @@ import { useEffect } from 'react'; import { useRouter } from 'next/router'; import * as Fathom from 'fathom-client'; -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types export const useFathom = () => { const router = useRouter(); useEffect(() => { - // Initialize Fathom when the app loads Fathom.load(process.env.FATHOM_ID, { - includedDomains: ['blockstack.design'], + excludedDomains: ['localhost'], }); function onRouteChangeComplete() { Fathom.trackPageview(); } - // Record a page view when route changes + router.events.on('routeChangeComplete', onRouteChangeComplete); - // Un assign event listener return () => { router.events.off('routeChangeComplete', onRouteChangeComplete); }; diff --git a/src/common/utils/index.ts b/src/common/utils/index.ts index b1bc1c43..752c588d 100644 --- a/src/common/utils/index.ts +++ b/src/common/utils/index.ts @@ -18,6 +18,8 @@ export const slugify = (string: string): string => .replace(/^-+/, '') // Trim - from start of text .replace(/-+$/, ''); // Trim - from end of text +export const capitalize = ([s, ...tring]: string): string => [s.toUpperCase(), ...tring].join(''); + export const border = ( width = 1, style: Property.BorderStyle = 'solid', diff --git a/src/components/app-wrapper.tsx b/src/components/app-wrapper.tsx index 52468b62..07084c56 100644 --- a/src/components/app-wrapper.tsx +++ b/src/components/app-wrapper.tsx @@ -7,17 +7,21 @@ import { ProgressBar } from '@components/progress-bar'; import { BaseLayout } from '@components/layouts/base-layout'; import { ColorModes } from '@components/color-modes/styles'; import { Meta } from '@components/meta-head'; +import { useFathom } from '@common/hooks/use-fathom'; -export const AppWrapper: React.FC = ({ children, isHome }) => ( - <> - - - - - - - {children} - - - -); +export const AppWrapper: React.FC = ({ children, isHome }) => { + useFathom(); + return ( + <> + + + + + + + {children} + + + + ); +}; diff --git a/src/components/mdx/markdown-wrapper.tsx b/src/components/mdx/markdown-wrapper.tsx index f258efb4..0d851f9d 100644 --- a/src/components/mdx/markdown-wrapper.tsx +++ b/src/components/mdx/markdown-wrapper.tsx @@ -1,8 +1,9 @@ import React from 'react'; import { MDContents } from '@components/mdx/md-contents'; import Head from 'next/head'; -import { getTitle } from '@common/utils'; +import { capitalize, getTitle } from '@common/utils'; import { PageTop } from '@components/page-top'; +import { MetaLabels } from '@components/meta-head'; const defaultFrontmatter = { headings: [], @@ -14,12 +15,28 @@ export const MDWrapper: React.FC = React.memo( ({ frontmatter = defaultFrontmatter, dynamicHeadings = [], ...props }) => { const { headings, description } = frontmatter; + const labels = [ + frontmatter.experience + ? { + label: 'Experience', + data: capitalize(frontmatter.experience), + } + : undefined, + frontmatter.duration + ? { + label: 'Duration', + data: frontmatter.duration, + } + : undefined, + ].filter(item => item); + return ( <> {getTitle(frontmatter)} | Blockstack + } headings={[...headings, ...dynamicHeadings]} diff --git a/src/components/mdx/md-contents.tsx b/src/components/mdx/md-contents.tsx index e8acf60b..d7ade54a 100644 --- a/src/components/mdx/md-contents.tsx +++ b/src/components/mdx/md-contents.tsx @@ -265,7 +265,7 @@ export const MDContents: React.FC = ({ pageTop: PageTop = null, headings, c display={['none', 'none', 'none', 'block']} > - + {/**/} {headings?.length ? : null} diff --git a/src/components/meta-head.tsx b/src/components/meta-head.tsx index df572ed9..ab17cdb9 100644 --- a/src/components/meta-head.tsx +++ b/src/components/meta-head.tsx @@ -3,11 +3,38 @@ import React from 'react'; import Head from 'next/head'; import { useFaviconName } from '@common/hooks/use-favicon'; -export const Meta: React.FC = props => { +export const MetaLabels = ({ labels }: any) => { + return labels?.length ? ( + + {labels.map(({ label, data }, key: number) => ( + + + + + ))} + + ) : null; +}; + +export const Meta: React.FC = () => { const filename = useFaviconName(); return ( + + + + + + ); }; diff --git a/src/components/page-top.tsx b/src/components/page-top.tsx index ea310d4b..a5c47a19 100644 --- a/src/components/page-top.tsx +++ b/src/components/page-top.tsx @@ -30,11 +30,11 @@ export const PageTop: React.FC = React.memo( headings, })} - {isHome ? ( - - - - ) : null} + {/*{isHome ? (*/} + {/* */} + {/* */} + {/* */} + {/*) : null}*/} {description ? (