diff --git a/.github/workflows/template-sync.yml b/.github/workflows/template-sync.yml index 6acec5d..adb439a 100644 --- a/.github/workflows/template-sync.yml +++ b/.github/workflows/template-sync.yml @@ -1,4 +1,4 @@ -# Workflow for automatically syncing updates to the AstroWind template as pull requests (https://github.com/AndreasAugustin/actions-template-sync?tab=readme-ov-file) +# Workflow for automatically syncing updates to the AstroWind template as pull requests (https://github.com/AndreasAugustin/actions-template-sync) name: Sync template repository via pull request on: diff --git a/.templatesyncignore b/.templatesyncignore index 5ba8ea5..f792b8b 100644 --- a/.templatesyncignore +++ b/.templatesyncignore @@ -16,3 +16,4 @@ src/content/post/* src/layouts/* src/pages/* src/config.yaml +src/navigation.ts diff --git a/README.md b/README.md new file mode 100644 index 0000000..7d56d30 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Personal website repository + +## Setup + +See the repositories of the [website template](https://github.com/onwidget/astrowind/), the [cookie consent implementation](https://github.com/jop-software/astro-cookieconsent), and the [template sync action](https://github.com/AndreasAugustin/actions-template-sync) for more details. + +```console +# Install dependencies +npm install + +# Install cookieconsent +npx astro add @jop-software/astro-cookieconsent + +# Start local dev server +npm run dev \ No newline at end of file diff --git a/astro.config.mjs b/astro.config.mjs deleted file mode 100644 index 324d934..0000000 --- a/astro.config.mjs +++ /dev/null @@ -1,99 +0,0 @@ -import path from 'path'; -import { fileURLToPath } from 'url'; - -import { defineConfig } from 'astro/config'; - -import sitemap from '@astrojs/sitemap'; -import tailwind from '@astrojs/tailwind'; -import mdx from '@astrojs/mdx'; -import partytown from '@astrojs/partytown'; -import icon from 'astro-icon'; -import compress from '@playform/compress'; - -import astrowind from './vendor/integration'; - -import { - readingTimeRemarkPlugin, - responsiveTablesRehypePlugin, - lazyImagesRehypePlugin, -} from './src/utils/frontmatter.mjs'; - -import jopSoftwarecookieconsent from '@jop-software/astro-cookieconsent'; - -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - -const hasExternalScripts = false; -const whenExternalScripts = (items = []) => - hasExternalScripts ? (Array.isArray(items) ? items.map((item) => item()) : [items()]) : []; - -export default defineConfig({ - output: 'static', - - integrations: [tailwind({ - applyBaseStyles: false, - }), sitemap(), mdx(), icon({ - include: { - tabler: ['*'], - 'flat-color-icons': [ - 'template', - 'gallery', - 'approval', - 'document', - 'advertising', - 'currency-exchange', - 'voice-presentation', - 'business-contact', - 'database', - ], - }, - }), ...whenExternalScripts(() => - partytown({ - config: { forward: ['dataLayer.push'] }, - }) - ), compress({ - CSS: true, - HTML: { - 'html-minifier-terser': { - removeAttributeQuotes: false, - }, - }, - Image: false, - JavaScript: true, - SVG: false, - Logger: 1, - }), astrowind({ - config: './src/config.yaml', - }), jopSoftwarecookieconsent({ - guiOptions: { - consentModal: { - layout: "box", - position: "bottom right", - equalWeightButtons: true, - flipButtons: false, - }, - preferencesModal: { - layout: "box", - position: "right", - equalWeightButtons: true, - flipButtons: false, - }, - }, - })], - - image: { - domains: ['cdn.pixabay.com'], - }, - - markdown: { - remarkPlugins: [readingTimeRemarkPlugin], - rehypePlugins: [responsiveTablesRehypePlugin, lazyImagesRehypePlugin], - }, - - vite: { - resolve: { - alias: { - '~': path.resolve(__dirname, './src'), - }, - }, - }, -}); \ No newline at end of file diff --git a/astro.config.ts b/astro.config.ts index 462563a..8681c59 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -24,51 +24,42 @@ const whenExternalScripts = (items: (() => AstroIntegration) | (() => AstroInteg export default defineConfig({ output: 'static', - integrations: [ - tailwind({ - applyBaseStyles: false, - }), - sitemap(), - mdx(), - icon({ - include: { - tabler: ['*'], - 'flat-color-icons': [ - 'template', - 'gallery', - 'approval', - 'document', - 'advertising', - 'currency-exchange', - 'voice-presentation', - 'business-contact', - 'database', - ], - }, - }), - - ...whenExternalScripts(() => - partytown({ - config: { forward: ['dataLayer.push'] }, - }) - ), - - compress({ - CSS: true, - HTML: { - 'html-minifier-terser': { - removeAttributeQuotes: false, - }, + integrations: [tailwind({ + applyBaseStyles: false, + }), sitemap(), mdx(), icon({ + include: { + tabler: ['*'], + 'flat-color-icons': [ + 'template', + 'gallery', + 'approval', + 'document', + 'advertising', + 'currency-exchange', + 'voice-presentation', + 'business-contact', + 'database', + ], + }, + }), ...whenExternalScripts(() => + partytown({ + config: { forward: ['dataLayer.push'] }, + }) + ), compress({ + CSS: true, + HTML: { + 'html-minifier-terser': { + removeAttributeQuotes: false, }, - Image: false, - JavaScript: true, - SVG: false, - Logger: 1, - }), - - astrowind({ - config: './src/config.yaml', - }), + }, + Image: false, + JavaScript: true, + SVG: false, + Logger: 1, + }), + astrowind({ + config: './src/config.yaml', + }), ], image: { @@ -87,4 +78,4 @@ export default defineConfig({ }, }, }, -}); +}); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 8ea5315..56d9181 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,12 +13,14 @@ "@astrolib/analytics": "^0.5.0", "@astrolib/seo": "^1.0.0-beta.6", "@fontsource-variable/inter": "^5.1.0", + "@jop-software/astro-cookieconsent": "^3.0.0", "astro": "^4.15.5", "astro-embed": "^0.7.2", "astro-icon": "^1.1.1", "limax": "4.1.0", "lodash.merge": "^4.6.2", - "unpic": "^3.18.0" + "unpic": "^3.18.0", + "vanilla-cookieconsent": "^3.0.1" }, "devDependencies": { "@astrojs/check": "^0.9.3", @@ -1773,6 +1775,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@jop-software/astro-cookieconsent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@jop-software/astro-cookieconsent/-/astro-cookieconsent-3.0.0.tgz", + "integrity": "sha512-EbjaGgzqKW17Ik8JI7HqBboCPIWsz+6CUh3s6Nw3AXp+TbFpg+GVI6Hqhtw7A+8tmO2N3KGsuaKP7GQbrZyTHw==", + "peerDependencies": { + "vanilla-cookieconsent": "^3.0.0" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.5", "license": "MIT", @@ -10031,6 +10041,11 @@ "dev": true, "license": "MIT" }, + "node_modules/vanilla-cookieconsent": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/vanilla-cookieconsent/-/vanilla-cookieconsent-3.0.1.tgz", + "integrity": "sha512-gqc4x7O9t1I4xWr7x6/jtQWPr4PZK26SmeA0iyTv1WyoECfAGnu5JEOExmMEP+5Fz66AT9OiCBO3GII4wDQHLw==" + }, "node_modules/vfile": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", diff --git a/package.json b/package.json index ea6cb8d..f9be966 100644 --- a/package.json +++ b/package.json @@ -27,12 +27,14 @@ "@astrolib/analytics": "^0.5.0", "@astrolib/seo": "^1.0.0-beta.6", "@fontsource-variable/inter": "^5.1.0", + "@jop-software/astro-cookieconsent": "^3.0.0", "astro": "^4.15.5", "astro-embed": "^0.7.2", "astro-icon": "^1.1.1", "limax": "4.1.0", "lodash.merge": "^4.6.2", - "unpic": "^3.18.0" + "unpic": "^3.18.0", + "vanilla-cookieconsent": "^3.0.1" }, "devDependencies": { "@astrojs/check": "^0.9.3", diff --git a/src/navigation.js b/src/navigation.js deleted file mode 100644 index a499eed..0000000 --- a/src/navigation.js +++ /dev/null @@ -1,89 +0,0 @@ - -import { getPermalink, getHomePermalink } from './utils/permalinks'; -const currentYear = new Date().getFullYear(); - -export const headerData = { - links: [ - { - text: 'Home', - href: getHomePermalink(), - }, - { - text: 'About', - href: getPermalink('/about'), - }, - { - text: 'Science', - href: getPermalink('/science'), - links: [ - { - text: 'For Public', - href: getPermalink('/science/public'), - }, - { - text: 'For Scientists', - href: getPermalink('/science/research'), - }, - { - text: 'News & Media', - href: getPermalink('/science/news'), - }, - ], - }, - { - text: 'CV', - href: getPermalink('/cv'), - }, - ], - actions: [{ text: 'GitHub', href: 'https://github.com/joriswitstok', target: '_blank' }], -}; - -export const footerData = { - links: [ - { - title: 'Main', - href: getHomePermalink(), - links: [ - { text: 'About', href: getPermalink('/about') }, - { text: 'CV', href: getPermalink('/cv') }, - ], - }, - { - title: 'Science', - href: getPermalink('/science'), - links: [ - { - text: 'For Public', - href: getPermalink('/science/public'), - }, - { - text: 'For Scientists', - href: getPermalink('/science/research'), - }, - { - text: 'News & Media', - href: getPermalink('/science/news'), - }, - ], - }, - { - title: 'External', - links: [ - { text: 'Cosmic Dawn Center', href: 'https://cosmicdawn.dk', target: '_blank' }, - { text: 'JADES Collaboration', href: 'https://jades-survey.github.io', target: '_blank' }, - { text: 'Kavli Institute for Cosmology', href: 'https://www.kicc.cam.ac.uk', target: '_blank' }, - { text: 'Cavendish Astrophysics', href: 'https://www.astro.phy.cam.ac.uk', target: '_blank' }, - ], - }, - ], - secondaryLinks: [ - { text: 'Privacy Policy', href: getPermalink('/privacy') }, - ], - socialLinks: [ - { ariaLabel: 'Github', icon: 'tabler:brand-github', href: 'https://github.com/joriswitstok', target: '_blank' }, - { ariaLabel: 'X', icon: 'tabler:brand-x', href: 'https://x.com/JorisWitstok', target: '_blank' }, - ], - footNote: ` - © ${currentYear} Joris Witstok · All rights reserved. - `, -}; diff --git a/src/navigation.ts b/src/navigation.ts index d5cd65b..a499eed 100644 --- a/src/navigation.ts +++ b/src/navigation.ts @@ -1,183 +1,89 @@ -import { getPermalink, getBlogPermalink, getAsset } from './utils/permalinks'; + +import { getPermalink, getHomePermalink } from './utils/permalinks'; +const currentYear = new Date().getFullYear(); export const headerData = { links: [ { - text: 'Homes', - links: [ - { - text: 'SaaS', - href: getPermalink('/homes/saas'), - }, - { - text: 'Startup', - href: getPermalink('/homes/startup'), - }, - { - text: 'Mobile App', - href: getPermalink('/homes/mobile-app'), - }, - { - text: 'Personal', - href: getPermalink('/homes/personal'), - }, - ], + text: 'Home', + href: getHomePermalink(), }, { - text: 'Pages', - links: [ - { - text: 'Features (Anchor Link)', - href: getPermalink('/#features'), - }, - { - text: 'Services', - href: getPermalink('/services'), - }, - { - text: 'Pricing', - href: getPermalink('/pricing'), - }, - { - text: 'About us', - href: getPermalink('/about'), - }, - { - text: 'Contact', - href: getPermalink('/contact'), - }, - { - text: 'Terms', - href: getPermalink('/terms'), - }, - { - text: 'Privacy policy', - href: getPermalink('/privacy'), - }, - ], + text: 'About', + href: getPermalink('/about'), }, { - text: 'Landing', + text: 'Science', + href: getPermalink('/science'), links: [ { - text: 'Lead Generation', - href: getPermalink('/landing/lead-generation'), - }, - { - text: 'Long-form Sales', - href: getPermalink('/landing/sales'), + text: 'For Public', + href: getPermalink('/science/public'), }, { - text: 'Click-Through', - href: getPermalink('/landing/click-through'), + text: 'For Scientists', + href: getPermalink('/science/research'), }, { - text: 'Product Details (or Services)', - href: getPermalink('/landing/product'), - }, - { - text: 'Coming Soon or Pre-Launch', - href: getPermalink('/landing/pre-launch'), - }, - { - text: 'Subscription', - href: getPermalink('/landing/subscription'), - }, - ], - }, - { - text: 'Blog', - links: [ - { - text: 'Blog List', - href: getBlogPermalink(), - }, - { - text: 'Article', - href: getPermalink('get-started-website-with-astro-tailwind-css', 'post'), - }, - { - text: 'Article (with MDX)', - href: getPermalink('markdown-elements-demo-post', 'post'), - }, - { - text: 'Category Page', - href: getPermalink('tutorials', 'category'), - }, - { - text: 'Tag Page', - href: getPermalink('astro', 'tag'), + text: 'News & Media', + href: getPermalink('/science/news'), }, ], }, { - text: 'Widgets', - href: '#', + text: 'CV', + href: getPermalink('/cv'), }, ], - actions: [{ text: 'Download', href: 'https://github.com/onwidget/astrowind', target: '_blank' }], + actions: [{ text: 'GitHub', href: 'https://github.com/joriswitstok', target: '_blank' }], }; export const footerData = { links: [ { - title: 'Product', - links: [ - { text: 'Features', href: '#' }, - { text: 'Security', href: '#' }, - { text: 'Team', href: '#' }, - { text: 'Enterprise', href: '#' }, - { text: 'Customer stories', href: '#' }, - { text: 'Pricing', href: '#' }, - { text: 'Resources', href: '#' }, - ], - }, - { - title: 'Platform', + title: 'Main', + href: getHomePermalink(), links: [ - { text: 'Developer API', href: '#' }, - { text: 'Partners', href: '#' }, - { text: 'Atom', href: '#' }, - { text: 'Electron', href: '#' }, - { text: 'AstroWind Desktop', href: '#' }, + { text: 'About', href: getPermalink('/about') }, + { text: 'CV', href: getPermalink('/cv') }, ], }, { - title: 'Support', + title: 'Science', + href: getPermalink('/science'), links: [ - { text: 'Docs', href: '#' }, - { text: 'Community Forum', href: '#' }, - { text: 'Professional Services', href: '#' }, - { text: 'Skills', href: '#' }, - { text: 'Status', href: '#' }, + { + text: 'For Public', + href: getPermalink('/science/public'), + }, + { + text: 'For Scientists', + href: getPermalink('/science/research'), + }, + { + text: 'News & Media', + href: getPermalink('/science/news'), + }, ], }, { - title: 'Company', + title: 'External', links: [ - { text: 'About', href: '#' }, - { text: 'Blog', href: '#' }, - { text: 'Careers', href: '#' }, - { text: 'Press', href: '#' }, - { text: 'Inclusion', href: '#' }, - { text: 'Social Impact', href: '#' }, - { text: 'Shop', href: '#' }, + { text: 'Cosmic Dawn Center', href: 'https://cosmicdawn.dk', target: '_blank' }, + { text: 'JADES Collaboration', href: 'https://jades-survey.github.io', target: '_blank' }, + { text: 'Kavli Institute for Cosmology', href: 'https://www.kicc.cam.ac.uk', target: '_blank' }, + { text: 'Cavendish Astrophysics', href: 'https://www.astro.phy.cam.ac.uk', target: '_blank' }, ], }, ], secondaryLinks: [ - { text: 'Terms', href: getPermalink('/terms') }, { text: 'Privacy Policy', href: getPermalink('/privacy') }, ], socialLinks: [ - { ariaLabel: 'X', icon: 'tabler:brand-x', href: '#' }, - { ariaLabel: 'Instagram', icon: 'tabler:brand-instagram', href: '#' }, - { ariaLabel: 'Facebook', icon: 'tabler:brand-facebook', href: '#' }, - { ariaLabel: 'RSS', icon: 'tabler:rss', href: getAsset('/rss.xml') }, - { ariaLabel: 'Github', icon: 'tabler:brand-github', href: 'https://github.com/onwidget/astrowind' }, + { ariaLabel: 'Github', icon: 'tabler:brand-github', href: 'https://github.com/joriswitstok', target: '_blank' }, + { ariaLabel: 'X', icon: 'tabler:brand-x', href: 'https://x.com/JorisWitstok', target: '_blank' }, ], footNote: ` - onWidget logo - Made by onWidget · All rights reserved. + © ${currentYear} Joris Witstok · All rights reserved. `, }; diff --git a/src/utils/frontmatter.mjs b/src/utils/frontmatter.mjs deleted file mode 100644 index c104022..0000000 --- a/src/utils/frontmatter.mjs +++ /dev/null @@ -1,39 +0,0 @@ -import getReadingTime from 'reading-time'; -import { toString } from 'mdast-util-to-string'; -import lazyLoadPlugin from 'rehype-plugin-image-native-lazy-loading'; - -export function readingTimeRemarkPlugin() { - return function (tree, file) { - const textOnPage = toString(tree); - const readingTime = Math.ceil(getReadingTime(textOnPage).minutes); - - file.data.astro.frontmatter.readingTime = readingTime; - }; -} - -export function responsiveTablesRehypePlugin() { - return function (tree) { - if (!tree.children) return; - - for (let i = 0; i < tree.children.length; i++) { - const child = tree.children[i]; - - if (child.type === 'element' && child.tagName === 'table') { - const wrapper = { - type: 'element', - tagName: 'div', - properties: { - style: 'overflow:auto', - }, - children: [child], - }; - - tree.children[i] = wrapper; - - i++; - } - } - }; -} - -export const lazyImagesRehypePlugin = lazyLoadPlugin; diff --git a/tailwind.config.cjs b/tailwind.config.cjs deleted file mode 100644 index 32b3139..0000000 --- a/tailwind.config.cjs +++ /dev/null @@ -1,24 +0,0 @@ -import defaultTheme from 'tailwindcss/defaultTheme'; -import typographyPlugin from '@tailwindcss/typography'; - -module.exports = { - content: ['./src/**/*.{astro,html,js,jsx,json,md,mdx,svelte,ts,tsx,vue}'], - theme: { - extend: { - colors: { - primary: 'var(--aw-color-primary)', - secondary: 'var(--aw-color-secondary)', - accent: 'var(--aw-color-accent)', - default: 'var(--aw-color-text-default)', - muted: 'var(--aw-color-text-muted)', - }, - fontFamily: { - sans: ['var(--aw-font-sans, ui-sans-serif)', ...defaultTheme.fontFamily.sans], - serif: ['var(--aw-font-serif, ui-serif)', ...defaultTheme.fontFamily.serif], - heading: ['var(--aw-font-heading, ui-sans-serif)', ...defaultTheme.fontFamily.sans], - }, - }, - }, - plugins: [typographyPlugin], - darkMode: 'class', -};