Compare commits

...

3 Commits

Author SHA1 Message Date
4ac7da1231
Refactor deployment workflow
All checks were successful
Test / test (push) Successful in 38s
Test / test (pull_request) Successful in 39s
2024-09-12 16:39:57 +00:00
a93400f090
Refactor Astro components and layouts 2024-09-12 16:39:06 +00:00
3376c53b2e
Refactor Astro components and layouts 2024-09-12 16:36:57 +00:00
11 changed files with 67 additions and 148 deletions

View File

@ -1,31 +0,0 @@
name: Deploy
on:
push:
branches:
- master
jobs:
build:
container: gitea/runner-images:ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v3
with:
name: website
path: dist/
compression-level: 9
deploy:
runs-on: self-hosted
needs: build
steps:
- uses: actions/download-artifact@v3
with:
name: website
- run: rsync --archive --delete-after ./ /var/www/popov.link/

View File

@ -1,6 +1,10 @@
---
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
type Props = {
readonly description?: string;
readonly title?: string;
};
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
const { title, description } = Astro.props;
---

View File

@ -2,6 +2,52 @@
---
<style lang="scss">
@import "../scss/_variables.scss";
header {
background-color: $colorBg;
border-bottom: 1px solid $colorHeader;
box-shadow: 0 5px 5px $colorBg;
left: 0;
line-height: 3.5em;
opacity: 0.975;
position: fixed;
right: 0;
top: 0;
}
nav {
margin: auto;
max-width: 60em;
padding: 0 4em;
text-align: right;
a {
color: $colorText;
padding: 0 1em;
&:visited {
color: $colorText;
}
}
}
@media (width <=684px) {
header {
box-shadow: none;
}
nav {
padding: 0 2em;
span {
display: none;
}
}
}
</style>
<header>
<nav>
<a href="/feed.xml">RSS</a>

View File

@ -1,6 +1,11 @@
---
import { type CollectionEntry } from "astro:content";
import dayjs from "dayjs";
type Props = {
readonly post: CollectionEntry<"blog">;
};
const { post } = Astro.props;
---

View File

@ -1,47 +0,0 @@
---
const { prevPost, nextPost } = Astro.props;
---
<style lang="scss">
.pagination {
overflow: hidden;
padding: 5rem 0;
width: 100%;
}
@media (width <=684px) {
.pagination {
padding: 2rem 0;
}
}
.prev,
.next {
max-width: 40%;
}
.prev {
float: left;
}
.next {
float: right;
}
</style>
<div class="pagination">
{
prevPost && (
<span class="prev">
<a href={`/blog/${prevPost.slug}`}>&lt; {prevPost.data.title}</a>
</span>
)
}
{
nextPost && (
<span class="next">
<a href={`/blog/${nextPost.slug}`}>{nextPost.data.title} &gt;</a>
</span>
)
}
</div>

View File

@ -3,6 +3,11 @@ import Head from "../components/Head.astro";
import Header from "../components/Header.astro";
import "../scss/global.scss";
type Props = {
readonly description?: string;
readonly title?: string;
};
const { title, description } = Astro.props;
---

View File

@ -1,9 +0,0 @@
---
import BaseLayout from "./BaseLayout.astro";
const { title, description } = Astro.props;
---
<BaseLayout title={title} description={description}>
<slot />
</BaseLayout>

View File

@ -1,25 +1,20 @@
---
import { type CollectionEntry, getCollection } from "astro:content";
import Comments from "../../components/Comments.astro";
import Layout from "../../layouts/PageLayout.astro";
import Pagination from "../../components/PostPagination.astro";
import Layout from "../../layouts/BaseLayout.astro";
export async function getStaticPaths() {
const posts = await getCollection("blog");
const total = posts.length;
return posts.map((post, index) => ({
return posts.map((post) => ({
params: { slug: post.slug },
props: {
post,
prevPost: index + 1 === total ? null : posts[index + 1],
nextPost: index === 0 ? null : posts[index - 1],
},
props: post,
}));
}
type Props = CollectionEntry<"blog">;
const { post, prevPost, nextPost } = Astro.props;
const post = Astro.props;
const { Content, remarkPluginFrontmatter } = await post.render();
---
@ -47,10 +42,6 @@ const { Content, remarkPluginFrontmatter } = await post.render();
<Content />
</section>
<section>
<Pagination prevPost={prevPost} nextPost={nextPost} />
</section>
<section>
<Comments />
</section>

View File

@ -1,7 +1,7 @@
---
import { getCollection } from "astro:content";
import Element from "../components/PostElement.astro";
import Layout from "../layouts/PageLayout.astro";
import Layout from "../layouts/BaseLayout.astro";
const posts = await getCollection("blog");
---

View File

@ -1,41 +0,0 @@
header {
background-color: $colorBg;
border-bottom: 1px solid $colorHeader;
box-shadow: 0 5px 5px $colorBg;
left: 0;
line-height: 3.5em;
opacity: 0.975;
position: fixed;
right: 0;
top: 0;
}
nav {
margin: auto;
max-width: 60em;
padding: 0 4em;
text-align: right;
a {
color: $colorText;
padding: 0 1em;
&:visited {
color: $colorText;
}
}
}
@media (width <=684px) {
header {
box-shadow: none;
}
nav {
padding: 0 2em;
span {
display: none;
}
}
}

View File

@ -1,7 +1,3 @@
// Base
@import "variables";
@import "framework";
@import "print";
// Modules
@import "navbar";