diff --git a/.github/workflows/default.yaml b/.github/workflows/default.yaml new file mode 100644 index 0000000..09d55d2 --- /dev/null +++ b/.github/workflows/default.yaml @@ -0,0 +1,48 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: [ main ] + +permissions: + contents: read + pages: write + id-token: write + +jobs: + build: + steps: + - name: Checkout your repository using git + uses: actions/checkout@v4 + - name: 🗳️ Setup pnpm cache + uses: https://github.com/actions/cache@v3 + with: + path: ${{ env.PNPM_STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ env.PNPM_CACHE_ID }} + restore-keys: | + ${{ runner.os }}-pnpm-store + - name: Install, build, and upload your site + uses: withastro/action@v2 + # with: + # path: . # The root location of your Astro project inside the repository. (optional) + # node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional) + # package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional) + + deploy: + needs: build + runs-on: ubuntu-latest + steps: + + - name: 🚀 Deploy files via SFTP + uses: https://github.com/pressidium/lftp-mirror-action@v1 + with: + host: ${{ secrets.FTP_HOST }} + port: ${{ secrets.FTP_PORT || 21 }} + user: ${{ secrets.FTP_USERNAME }} + pass: ${{ secrets.FTP_PASSWORD }} + onlyNewer: true + parallel: '4' + settings: 'sftp:auto-confirm=yes' + localDir: 'public' + remoteDir: '/share' + options: '--verbose' diff --git a/public/app.css b/public/app.css index 96da8cb..dbf5d07 100644 --- a/public/app.css +++ b/public/app.css @@ -9,16 +9,21 @@ h3 { font-family: 'Roboto', sans-serif; } -article h2 { +article>h2 { font-size: 24px; margin-top: 20px; } -article h3 { +article>h3 { font-size: 20px; margin-top: 16px; } +article>p>a, +article a { + color: var(--fill) !important; +} + :root { --neutral-1000: #000000; --neutral-800: #16161E; diff --git a/src/components/GoogleyEye.svelte b/src/components/GoogleyEye.svelte index b6d4708..13ea1f8 100644 --- a/src/components/GoogleyEye.svelte +++ b/src/components/GoogleyEye.svelte @@ -92,8 +92,7 @@
($visible = !$visible)} - role="button" - tabindex="0" + role="img" aria-label="Toggle Googley Eyes" aria-hidden="true" on:keydown={(ev) => (ev.key === "Enter" ? ($visible = !$visible) : "")} diff --git a/src/components/HeroCard.astro b/src/components/HeroCard.astro index 30170df..b97b040 100644 --- a/src/components/HeroCard.astro +++ b/src/components/HeroCard.astro @@ -1,7 +1,7 @@ --- import markdownToText from "@helpers/markdownToText"; import { Card } from "./card"; -import { useTranslatedPath } from "@i18n/utils"; +import { useTranslatedPath, useTranslations } from "@i18n/utils"; import Image from "@components/Image.astro"; interface Props { @@ -25,6 +25,7 @@ const { } = Astro.props.post; const translatePath = useTranslatedPath(Astro); +const t = useTranslations(Astro); const imagePath = `../content/${collection}/${slug.split("/")[0]}/${headerImg}`; @@ -44,7 +45,7 @@ const link = translatePath(`/${collection}/${slug.split("/")[0]}`); {markdownToText(body).slice(0, 200)} - + { image?.format && ( diff --git a/src/components/Image.astro b/src/components/Image.astro index 17f7172..b2028c8 100644 --- a/src/components/Image.astro +++ b/src/components/Image.astro @@ -11,8 +11,6 @@ interface Props { const { src: image, alt, maxWidth } = Astro.props; -console.log({ image, alt, maxWidth }); - const sizes = [ { width: 240, diff --git a/src/components/Nav.astro b/src/components/Nav.astro index 15cff39..f5c9e29 100644 --- a/src/components/Nav.astro +++ b/src/components/Nav.astro @@ -1,6 +1,7 @@ --- import { useTranslations, useTranslatedPath } from "../i18n/utils"; import Logo from "./Logo.astro"; +import ToggleTheme from "@components/ThemeToggle.svelte"; function isActive(path: string) { return Astro.url.pathname === path ? "active" : ""; @@ -10,10 +11,6 @@ const t = useTranslations(Astro); const translatePath = useTranslatedPath(Astro); const paths = [ - { - link: translatePath("/"), - component: Logo, - }, { link: translatePath("/blog"), text: t("nav.blog"), @@ -33,16 +30,26 @@ const paths = [ ]; --- -
    + diff --git a/src/components/ThemeToggle.svelte b/src/components/ThemeToggle.svelte new file mode 100644 index 0000000..b9eebfe --- /dev/null +++ b/src/components/ThemeToggle.svelte @@ -0,0 +1,59 @@ + + + diff --git a/src/content/photos/sestri-levante/index.mdx b/src/content/photos/sestri-levante/index.mdx index 3d300d7..2cb1ec8 100644 --- a/src/content/photos/sestri-levante/index.mdx +++ b/src/content/photos/sestri-levante/index.mdx @@ -7,22 +7,22 @@ comments: true --- import Image from "@components/Image.astro"; +import MAX_7053 from "./images/MAX_7053.jpg"; +import MAX_7054 from "./images/MAX_7054.jpg"; +import MAX_7055_Panorama from "./images/MAX_7055-Panorama.jpg"; +import MAX_7076_Panorama from "./images/MAX_7076-Panorama.jpg"; Best images from a short trip to liguria in italy This image took way to long, had to do several attempts because its really hard to get focus and exposure right when you use self-timer. But i think in the end it payed off :) -import MAX_7053 from "./images/MAX_7053.jpg"; - + Liminal spaces anyone? -import MAX_7054 from "./images/MAX_7054.jpg"; - + I had one day with a bit of rain, but that was actually really nice because i never saw this part of the coast in fog. -import MAX_7055_Panorama from "./images/MAX_7055-Panorama.jpg"; - + Sestri Levante is just nice to look at. -import MAX_7076_Panorama from "./images/MAX_7076-Panorama.jpg"; - + diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index bc56050..3eff277 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -72,7 +72,7 @@ const { title, width = "compact" } = Astro.props;
    -
    +
    diff --git a/src/pages/projects/index.astro b/src/pages/projects/index.astro index 715e2d3..90f379b 100644 --- a/src/pages/projects/index.astro +++ b/src/pages/projects/index.astro @@ -7,7 +7,9 @@ import HeroCard from "@components/HeroCard.astro"; const locale = getLocale(Astro.url); const pages = await getCollection("projects"); -const posts = filterCollection(pages, locale); +const posts = filterCollection(pages, locale) + .sort((a, b) => b.data.date - a.data.date) + .sort((a) => (a.data.featured ? -1 : 1)); --- diff --git a/src/pages/tag/[tag].astro b/src/pages/tag/[tag].astro new file mode 100644 index 0000000..920c18d --- /dev/null +++ b/src/pages/tag/[tag].astro @@ -0,0 +1,71 @@ +--- +import Layout from "@layouts/Layout.astro"; +import { getCollection } from "astro:content"; +import { useTranslatedPath } from "@i18n/utils"; + +const collections = ["blog", "photos", "projects"]; + +const tp = useTranslatedPath(Astro); + +export async function getStaticPaths() { +const collections = ["blog", "photos", "projects"]; +const posts = await Promise.all( + collections.map((collection) => { + return getCollection(collection, { + fields: ["slug", "title", "date", "tags"], + }); + }), +); + +const tags = new Set(); + +posts.flat().forEach((post) => { + if (!post.data?.tags) return; + post.data.tags.forEach((tag) => { + tags.add(tag.toLowerCase()); + }); +}); + + return [...tags.values()].map((tag) => { + return { + params: { + tag, + }, + }; + }); +} + +const { tag } = Astro.params; + + +const allPosts = (await Promise.all( + collections.map((collection) => { + return getCollection(collection, { + fields: ["slug", "title", "date", "tags"], + }); + }), +)).flat(); + + + +const posts = allPosts.filter((post) => { + return post.data?.tags?.find(t => t.toLowerCase() === tag); +}); + + +--- + + +
    +

    Tags

    + {posts.length} +
    + { + posts.map((post) => { + return {post.slug}; + }) + } +
    +
    +
    + diff --git a/src/pages/tag/index.astro b/src/pages/tag/index.astro new file mode 100644 index 0000000..872f227 --- /dev/null +++ b/src/pages/tag/index.astro @@ -0,0 +1,41 @@ +--- +import Layout from "@layouts/Layout.astro"; +import { getCollection } from "astro:content"; +import { useTranslatedPath } from "@i18n/utils"; + +const tp = useTranslatedPath(Astro); + +const collections = ["blog", "photos", "projects"]; + +const posts = await Promise.all( + collections.map((collection) => { + return getCollection(collection, { + fields: ["slug", "title", "date", "tags"], + }); + }), +); + +const tags = new Set(); + +posts.flat().forEach((post) => { + if (!post.data?.tags) return; + post.data.tags.forEach((tag) => { + tags.add(tag.toLowerCase()); + }); +}); + +const _tags = [...tags.values()]; +--- + + +
    +

    Tags

    +
    + { + _tags.map((t) => { + return {t}; + }) + } +
    +
    +
    diff --git a/uno.config.ts b/uno.config.ts index 311da6c..0bd7b24 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -15,7 +15,7 @@ export default defineConfig({ "border-neutral": "border-neutral-300 dark:border-neutral-1000", "border-light": "border-neutral-100 dark:border-neutral-500", "divide-x-neutral": ['divide-x-neutral-300', "dark:divide-x-neutral-1000"], - "gradient": "bg-gradient-to-br from-neutral-000 dark:from-neutral-500 to-neutral-200 dark:to-neutral-800", + "gradient": "bg-gradient-to-br from-neutral-000 to-neutral-000 dark:from-neutral-500 dark:to-neutral-800", }, theme: { borderRadius: {