-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
146 additions
and
293 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
import Footer from '../components/Footer.astro'; | ||
import Header from '../components/Header.astro'; | ||
interface Props { | ||
title: string; | ||
description: string; | ||
image?: string; | ||
} | ||
const canonicalURL = new URL(Astro.url.pathname, Astro.site); | ||
const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props; | ||
--- | ||
|
||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<!-- Global Metadata --> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> | ||
<meta name="generator" content={Astro.generator} /> | ||
|
||
<!-- Canonical URL --> | ||
<link rel="canonical" href={canonicalURL} /> | ||
|
||
<!-- Primary Meta Tags --> | ||
<title>{title}</title> | ||
<meta name="title" content={title} /> | ||
<meta name="description" content={description} /> | ||
|
||
<!-- Open Graph / Facebook --> | ||
<meta property="og:type" content="website" /> | ||
<meta property="og:url" content={Astro.url} /> | ||
<meta property="og:title" content={title} /> | ||
<meta property="og:description" content={description} /> | ||
<meta property="og:image" content={new URL(image, Astro.url)} /> | ||
|
||
<!-- Twitter --> | ||
<meta property="twitter:card" content="summary_large_image" /> | ||
<meta property="twitter:url" content={Astro.url} /> | ||
<meta property="twitter:title" content={title} /> | ||
<meta property="twitter:description" content={description} /> | ||
<meta property="twitter:image" content={new URL(image, Astro.url)} /> | ||
</head> | ||
<body> | ||
<Header /> | ||
<main> | ||
<slot /> | ||
</main> | ||
<Footer /> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,34 @@ | ||
--- | ||
import type { CollectionEntry } from 'astro:content'; | ||
import BaseHead from '../components/BaseHead.astro'; | ||
import Header from '../components/Header.astro'; | ||
import Footer from '../components/Footer.astro'; | ||
import FormattedDate from '../components/FormattedDate.astro'; | ||
import Base from './Base.astro'; | ||
type Props = CollectionEntry<'blog'>['data']; | ||
const { title, description, pubDate, updatedDate, heroImage } = Astro.props; | ||
--- | ||
|
||
<html lang="en"> | ||
<head> | ||
<BaseHead title={title} description={description} /> | ||
<style> | ||
main { | ||
width: calc(100% - 2em); | ||
max-width: 100%; | ||
margin: 0; | ||
} | ||
.hero-image { | ||
width: 100%; | ||
} | ||
.hero-image img { | ||
display: block; | ||
margin: 0 auto; | ||
border-radius: 12px; | ||
box-shadow: var(--box-shadow); | ||
} | ||
.prose { | ||
width: 720px; | ||
max-width: calc(100% - 2em); | ||
margin: auto; | ||
padding: 1em; | ||
color: rgb(var(--gray-dark)); | ||
} | ||
.title { | ||
margin-bottom: 1em; | ||
padding: 1em 0; | ||
text-align: center; | ||
line-height: 1; | ||
} | ||
.title h1 { | ||
margin: 0 0 0.5em 0; | ||
} | ||
.date { | ||
margin-bottom: 0.5em; | ||
color: rgb(var(--gray)); | ||
} | ||
.last-updated-on { | ||
font-style: italic; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<Header /> | ||
<main> | ||
<article> | ||
<div class="hero-image"> | ||
<Base title={title} description={description}> | ||
<article> | ||
<div class="hero-image"> | ||
{heroImage && <img width={1020} height={510} src={heroImage} alt="" />} | ||
</div> | ||
<div class="prose"> | ||
<div class="title"> | ||
<div class="date"> | ||
<FormattedDate date={pubDate} /> | ||
{ | ||
heroImage && ( | ||
<img width={1020} height={510} src={heroImage} alt="" /> | ||
updatedDate && ( | ||
<div class="last-updated-on"> | ||
Last updated on <FormattedDate date={updatedDate} /> | ||
</div> | ||
) | ||
} | ||
</div> | ||
<div class="prose"> | ||
<div class="title"> | ||
<div class="date"> | ||
<FormattedDate date={pubDate} /> | ||
{ | ||
updatedDate && ( | ||
<div class="last-updated-on"> | ||
Last updated on <FormattedDate date={updatedDate} /> | ||
</div> | ||
) | ||
} | ||
</div> | ||
<h1>{title}</h1> | ||
<hr /> | ||
</div> | ||
<slot /> | ||
</div> | ||
</article> | ||
</main> | ||
<Footer /> | ||
</body> | ||
</html> | ||
<h1>{title}</h1> | ||
<hr /> | ||
</div> | ||
<slot /> | ||
</div> | ||
</article> | ||
</Base> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
404 | ||
</body> | ||
</html> | ||
--- | ||
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'; | ||
import Base from '../layouts/Base.astro'; | ||
--- | ||
|
||
<Base title={SITE_TITLE} description={SITE_DESCRIPTION}> 404</Base> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,30 @@ | ||
--- | ||
import BaseHead from '../../components/BaseHead.astro'; | ||
import Header from '../../components/Header.astro'; | ||
import Footer from '../../components/Footer.astro'; | ||
import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts'; | ||
import { getCollection } from 'astro:content'; | ||
import FormattedDate from '../../components/FormattedDate.astro'; | ||
import Base from '../../layouts/Base.astro'; | ||
const posts = (await getCollection('blog')).sort( | ||
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf(), | ||
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf() | ||
); | ||
--- | ||
|
||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} /> | ||
<style> | ||
main { | ||
width: 960px; | ||
} | ||
ul { | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 2rem; | ||
list-style-type: none; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
ul li { | ||
width: calc(50% - 1rem); | ||
} | ||
ul li * { | ||
text-decoration: none; | ||
transition: 0.2s ease; | ||
} | ||
ul li:first-child { | ||
width: 100%; | ||
margin-bottom: 1rem; | ||
text-align: center; | ||
} | ||
ul li:first-child img { | ||
width: 100%; | ||
} | ||
ul li:first-child .title { | ||
font-size: 2.369rem; | ||
} | ||
ul li img { | ||
margin-bottom: 0.5rem; | ||
border-radius: 12px; | ||
} | ||
ul li a { | ||
display: block; | ||
} | ||
.title { | ||
margin: 0; | ||
color: rgb(var(--black)); | ||
line-height: 1; | ||
} | ||
.date { | ||
margin: 0; | ||
color: rgb(var(--gray)); | ||
} | ||
ul li a:hover h4, | ||
ul li a:hover .date { | ||
color: rgb(var(--accent)); | ||
} | ||
ul a:hover img { | ||
box-shadow: var(--box-shadow); | ||
} | ||
@media (max-width: 720px) { | ||
ul { | ||
gap: 0.5em; | ||
} | ||
ul li { | ||
width: 100%; | ||
text-align: center; | ||
} | ||
ul li:first-child { | ||
margin-bottom: 0; | ||
} | ||
ul li:first-child .title { | ||
font-size: 1.563em; | ||
} | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<Header /> | ||
<main> | ||
<section> | ||
<ul> | ||
{ | ||
posts.map((post) => ( | ||
<li> | ||
<a href={`/blog/${post.slug}/`}> | ||
<img | ||
width={720} | ||
height={360} | ||
src={post.data.heroImage} | ||
alt="" | ||
/> | ||
<h4 class="title">{post.data.title}</h4> | ||
<p class="date"> | ||
<FormattedDate date={post.data.pubDate} /> | ||
</p> | ||
</a> | ||
</li> | ||
)) | ||
} | ||
</ul> | ||
</section> | ||
</main> | ||
<Footer /> | ||
</body> | ||
</html> | ||
<Base title={SITE_TITLE} description={SITE_DESCRIPTION}> | ||
<section> | ||
<ul> | ||
{ | ||
posts.map((post) => ( | ||
<li> | ||
<a href={`/blog/${post.slug}/`}> | ||
<img width={720} height={360} src={post.data.heroImage} alt="" /> | ||
<h4 class="title">{post.data.title}</h4> | ||
<p class="date"> | ||
<FormattedDate date={post.data.pubDate} /> | ||
</p> | ||
</a> | ||
</li> | ||
)) | ||
} | ||
</ul> | ||
</section> | ||
</Base> |
Oops, something went wrong.