diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index a7fca07..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Trigger Netlify Build -on: - schedule: - # Run at 12:05 on Friday - - cron: "05 10 * * 5" -jobs: - build: - name: Request Netlify Webhook - runs-on: ubuntu-latest - steps: - - name: Curl request - run: curl -X POST -d {} https://api.netlify.com/build_hooks/61080485234cb0f6cc818a31 diff --git a/.gitignore b/.gitignore index 29fa38a..de91573 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,4 @@ yarn-debug.log* yarn-error.log* # Other -.env +.env*.local diff --git a/next.config.js b/next.config.js index ec88f4a..a1e9d17 100644 --- a/next.config.js +++ b/next.config.js @@ -23,5 +23,6 @@ module.exports = { }, future: { webpack5: true - } + }, + generateBuildId: () => 'build' }; diff --git a/pages/404.tsx b/pages/404.tsx index 1d6f062..3be40f1 100644 --- a/pages/404.tsx +++ b/pages/404.tsx @@ -1,5 +1,5 @@ import { GetStaticProps } from 'next'; -import generateOGImage from '../src/static/js/utils/generateOGImage'; +import getOGImage from '../src/static/js/utils/getOGImage'; import query from '../src/static/js/utils/api/query'; import ErrorPage from './error/[status]'; @@ -7,7 +7,7 @@ export const getStaticProps: GetStaticProps = async () => { const { copy } = await query('/content/ui'); const status = '404'; - const ogImage = await generateOGImage('/error', {}); + const ogImage = await getOGImage('/error', {}); return { props: { diff --git a/pages/api/content/friday-tips/index.tsx b/pages/api/content/friday-tips/index.tsx index 3f4a8ab..85b174d 100644 --- a/pages/api/content/friday-tips/index.tsx +++ b/pages/api/content/friday-tips/index.tsx @@ -4,7 +4,7 @@ import convertYoutubeDataToFridayTip from 'static/js/utils/convertYoutubeDataToF export default async (req: NextApiRequest, res: NextApiResponse) => { const baseURL = "https://www.googleapis.com/youtube/v3/"; - const playlistId = "AIzaSyA2cTY2EnBIr4iSGrIkCZAqzL85UDwhnqI"; + const playlistId = "PLsES66lgcKHD9oRnyN3PEvyTjWXJF4IgT"; const { items } = await fetch(`${baseURL}playlistItems?maxResults=50&part=snippet,contentDetails&playlistId=${playlistId}&key=${process.env.YOUTUBE_API_KEY}`) .then(res => res.json()) diff --git a/pages/articles/[slug].tsx b/pages/articles/[slug].tsx index 9a288a6..c884ad8 100644 --- a/pages/articles/[slug].tsx +++ b/pages/articles/[slug].tsx @@ -6,7 +6,7 @@ import { GetStaticProps } from 'next' import query from '../../src/static/js/utils/api/query'; import { ArticleInterface, ContentObjectInterface } from '../../src/static/js/utils/Interfaces/Interfaces'; import { ArticleTypeType } from '../../src/static/js/utils/Interfaces/Types'; -import generateOGImage from '../../src/static/js/utils/generateOGImage'; +import getOGImage from '../../src/static/js/utils/getOGImage'; // Resources @@ -54,7 +54,7 @@ export const getStaticProps: GetStaticProps = async (context) => { const articleData = articles.find((article: ArticleInterface) => context && context.params ? article.slug === context.params.slug : false); - const ogImage = await generateOGImage(`/articles_${articleData.slug}`, { title: articleData.title, image: articleData.teaserImage, date: articleData.date }); + const ogImage = await getOGImage(`/articles_${articleData.slug}`, { title: articleData.title, image: articleData.teaserImage, date: articleData.date }); return { props: { diff --git a/pages/articles/index.tsx b/pages/articles/index.tsx index c7b5bc0..f2e008b 100644 --- a/pages/articles/index.tsx +++ b/pages/articles/index.tsx @@ -6,7 +6,7 @@ import { GetStaticProps } from 'next' import query from '../../src/static/js/utils/api/query'; import { ArticleInterface } from '../../src/static/js/utils/Interfaces/Interfaces'; import { ArticleTypeType } from '../../src/static/js/utils/Interfaces/Types'; -import generateOGImage from '../../src/static/js/utils/generateOGImage'; +import getOGImage from '../../src/static/js/utils/getOGImage'; // Resources @@ -32,7 +32,7 @@ export const getStaticProps: GetStaticProps = async () => { const { copy, headings } = await query('/content/ui'); const { articles } = await query('/content/articles'); - const ogImage = await generateOGImage('/articles', { title: headings.latestArticles, image: '/img/articles.jpg' }); + const ogImage = await getOGImage('/articles', { title: headings.latestArticles, image: '/img/articles.jpg' }); return { props: { diff --git a/pages/error/[status].tsx b/pages/error/[status].tsx index 58a80ae..da6d46d 100644 --- a/pages/error/[status].tsx +++ b/pages/error/[status].tsx @@ -5,7 +5,7 @@ import { GetStaticProps } from 'next'; // Utils import query from '../../src/static/js/utils/api/query'; import { HTTPStatusCodeType } from '../../src/static/js/utils/Interfaces/Types'; -import generateOGImage from '../../src/static/js/utils/generateOGImage'; +import getOGImage from '../../src/static/js/utils/getOGImage'; // Components @@ -33,7 +33,7 @@ export const getStaticPaths = async () => { export const getStaticProps: GetStaticProps = async () => { const { copy } = await query('/content/ui'); const status = '500'; - const ogImage = await generateOGImage('/error', {}); + const ogImage = await getOGImage('/error', {}); return { props: { diff --git a/pages/friday-tips/[slug].tsx b/pages/friday-tips/[slug].tsx index 4696e28..753dd6f 100644 --- a/pages/friday-tips/[slug].tsx +++ b/pages/friday-tips/[slug].tsx @@ -3,7 +3,7 @@ import { GetStaticProps } from 'next'; // Uitls import query from '../../src/static/js/utils/api/query'; -import generateOGImage from '../../src/static/js/utils/generateOGImage'; +import getOGImage from '../../src/static/js/utils/getOGImage'; import { ArticleInterface } from '../../src/static/js/utils/Interfaces/Interfaces'; // Components @@ -24,7 +24,7 @@ export const getStaticProps: GetStaticProps = async (context) => { const articleData = fridayTips.find((fridayTip: ArticleInterface) => context && context.params ? fridayTip.slug === context.params.slug : false); - const ogImage = await generateOGImage(`/friday-tips_${articleData.slug}`, { title: articleData.title, image: articleData.teaserImage, date: articleData.date }); + const ogImage = await getOGImage(`/friday-tips_${articleData.slug}`, { title: articleData.title, image: articleData.teaserImage, date: articleData.date }); return { props: { diff --git a/pages/friday-tips/index.tsx b/pages/friday-tips/index.tsx index 41bb595..58f5332 100644 --- a/pages/friday-tips/index.tsx +++ b/pages/friday-tips/index.tsx @@ -3,7 +3,7 @@ import { GetStaticProps } from 'next'; // Utils import query from '../../src/static/js/utils/api/query'; -import generateOGImage from '../../src/static/js/utils/generateOGImage'; +import getOGImage from '../../src/static/js/utils/getOGImage'; // Components import Index from '../articles/index'; @@ -12,7 +12,7 @@ export const getStaticProps: GetStaticProps = async () => { const { copy, headings } = await query('/content/ui'); const { fridayTips } = await query('/content/friday-tips'); - const ogImage = await generateOGImage('/friday-tips', { title: headings.latestFridayTips, image: '/img/friday-tips.jpg' }); + const ogImage = await getOGImage('/friday-tips', { title: headings.latestFridayTips, image: '/img/friday-tips.jpg' }); return { props: { diff --git a/pages/index.tsx b/pages/index.tsx index 1f39bbf..a83dc40 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -12,7 +12,7 @@ import query from '../src/static/js/utils/api/query'; import ArticleTeasers from '../src/components/Article/ArticleTeasers/ArticleTeasers'; import ResumePitch from '../src/components/Resume/ResumePitch/ResumePitch'; import { ArticleInterface, ContentObjectInterface } from '../src/static/js/utils/Interfaces/Interfaces'; -import generateOGImage from 'static/js/utils/generateOGImage'; +import getOGImage from 'static/js/utils/getOGImage'; // Interface interface IProps { @@ -95,7 +95,7 @@ export const getStaticProps: GetStaticProps = async () => { const quickBitTeaserItems = quickBits.slice(0, 3); const fridayTipTeaserItems = fridayTips.slice(0, 3); - const ogImage = await generateOGImage('/index', {}); + const ogImage = await getOGImage('/index', {}); return { props: { diff --git a/pages/quick-bits/[slug].tsx b/pages/quick-bits/[slug].tsx index 8c09719..cd824eb 100644 --- a/pages/quick-bits/[slug].tsx +++ b/pages/quick-bits/[slug].tsx @@ -4,7 +4,7 @@ import { GetStaticProps } from 'next'; // Uitls import query from '../../src/static/js/utils/api/query'; import { ArticleInterface } from '../../src/static/js/utils/Interfaces/Interfaces'; -import generateOGImage from '../../src/static/js/utils/generateOGImage'; +import getOGImage from '../../src/static/js/utils/getOGImage'; // Components import Index from '../articles/[slug]'; @@ -24,7 +24,7 @@ export const getStaticProps: GetStaticProps = async (context) => { const articleData = quickBits.find((quickBit: ArticleInterface) => context && context.params ? quickBit.slug === context.params.slug : false); - const ogImage = await generateOGImage(`/quick-bits_${articleData.slug}`, { title: articleData.title, image: articleData.teaserImage, date: articleData.date }); + const ogImage = await getOGImage(`/quick-bits_${articleData.slug}`, { title: articleData.title, image: articleData.teaserImage, date: articleData.date }); return { props: { diff --git a/pages/quick-bits/index.tsx b/pages/quick-bits/index.tsx index d252d23..d5157f1 100644 --- a/pages/quick-bits/index.tsx +++ b/pages/quick-bits/index.tsx @@ -3,7 +3,7 @@ import { GetStaticProps } from 'next'; // Utils import query from '../../src/static/js/utils/api/query'; -import generateOGImage from '../../src/static/js/utils/generateOGImage'; +import getOGImage from '../../src/static/js/utils/getOGImage'; // Components import Index from '../articles/index'; @@ -12,7 +12,7 @@ export const getStaticProps: GetStaticProps = async () => { const { copy, headings } = await query('/content/ui'); const { quickBits } = await query('/content/quick-bits'); - const ogImage = await generateOGImage('/quick-bits', { title: headings.latestQuickBits, image: '/img/articles.jpg' }); + const ogImage = await getOGImage('/quick-bits', { title: headings.latestQuickBits, image: '/img/articles.jpg' }); return { props: { diff --git a/pages/resume/index.tsx b/pages/resume/index.tsx index 426a58e..f6370e9 100644 --- a/pages/resume/index.tsx +++ b/pages/resume/index.tsx @@ -4,7 +4,7 @@ import { GetStaticProps } from 'next'; // Utils import query from '../../src/static/js/utils/api/query'; -import generateOGImage from '../../src/static/js/utils/generateOGImage'; +import getOGImage from '../../src/static/js/utils/getOGImage'; // Resources @@ -43,7 +43,7 @@ export const getStaticProps: GetStaticProps = async () => { const { copy, headings } = await query('/content/ui'); const { workExperience, education } = await query('/content/work-and-education'); - const ogImage = await generateOGImage('/resume', { title: headings.greeting }); + const ogImage = await getOGImage('/resume', { title: headings.greeting }); return { props: { diff --git a/pages/tags/[tag].tsx b/pages/tags/[tag].tsx index 4d18c41..40fc77b 100644 --- a/pages/tags/[tag].tsx +++ b/pages/tags/[tag].tsx @@ -5,7 +5,7 @@ import { GetStaticProps } from 'next'; // Utils import query from '../../src/static/js/utils/api/query'; import { ArticleInterface, ContentObjectInterface, TagInterface } from '../../src/static/js/utils/Interfaces/Interfaces'; -import generateOGImage from '../../src/static/js/utils/generateOGImage'; +import getOGImage from '../../src/static/js/utils/getOGImage'; // Resources @@ -68,7 +68,7 @@ export const getStaticProps: GetStaticProps = async (context) => { .filter((quickBit: ArticleInterface) => quickBit.tags.find((tag: TagInterface) => tag.key === activeTag)); const tagLabel = context.params && context.params.tag && activeTag ? tags[Array.isArray(activeTag) ? activeTag[0] : activeTag] : null; - const ogImage = await generateOGImage(`/tags_${activeTag}`, { title: tagLabel || activeTag, image: `/img/tags/${activeTag}.jpg` }); + const ogImage = await getOGImage(`/tags_${activeTag}`, { title: tagLabel || activeTag, image: `/img/tags/${activeTag}.jpg` }); return { props: { diff --git a/pages/tags/index.tsx b/pages/tags/index.tsx index e7a9068..8ded5f6 100644 --- a/pages/tags/index.tsx +++ b/pages/tags/index.tsx @@ -6,7 +6,7 @@ import { GetStaticProps } from 'next' import query from '../../src/static/js/utils/api/query'; import { ArticleInterface } from '../../src/static/js/utils/Interfaces/Interfaces'; import { ArticleTypeType } from '../../src/static/js/utils/Interfaces/Types'; -import generateOGImage from '../../src/static/js/utils/generateOGImage'; +import getOGImage from '../../src/static/js/utils/getOGImage'; // Resources @@ -33,7 +33,7 @@ export const getStaticProps: GetStaticProps = async () => { const { articles } = await query('/content/articles'); const { quickBits } = await query('/content/quick-bits'); - const ogImage = await generateOGImage('/tags_index', { title: headings.latestArticlesAndTags, image: '/img/articles.jpg' }); + const ogImage = await getOGImage('/tags_index', { title: headings.latestArticlesAndTags, image: '/img/articles.jpg' }); return { props: { diff --git a/src/static/js/utils/generateOGImage.ts b/src/static/js/utils/getOGImage.ts similarity index 86% rename from src/static/js/utils/generateOGImage.ts rename to src/static/js/utils/getOGImage.ts index 2f5d5a4..07ec661 100644 --- a/src/static/js/utils/generateOGImage.ts +++ b/src/static/js/utils/getOGImage.ts @@ -4,7 +4,7 @@ import query from './api/query'; import generateQueryString from './generateQueryString'; import { OGImageRequestInterface } from "./Interfaces/Interfaces"; -const generateOGImage = async (path: string, { title = 'davebitter.com', date, image }: OGImageRequestInterface) => { +const getOGImage = async (path: string, { title = 'davebitter.com', date, image }: OGImageRequestInterface) => { if (process.env.NODE_ENV === 'development') { return path; } @@ -35,4 +35,4 @@ const generateOGImage = async (path: string, { title = 'davebitter.com', date, i } }; -export default generateOGImage; \ No newline at end of file +export default getOGImage; \ No newline at end of file