feat: meta viewport

This commit is contained in:
Lewis Wynne 2026-01-23 16:05:52 +00:00
parent 573b0eef89
commit d1803384a6
8 changed files with 45 additions and 67 deletions

View file

@ -0,0 +1,23 @@
---
import '../styles/global.css';
interface Props {
title: string;
showHeader?: boolean;
isHome?: boolean;
}
const { title, showHeader = true, isHome = false } = Astro.props;
---
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>{title}</title></head>
<body>
{showHeader && (
<header>
<pre>{isHome ? 'lewis m.w.' : <a href="/">lewis m.w.</a>} <a href="mailto:lewis@wynne.rs">mail</a> <a href="https://github.com/llywelwyn">gh</a></pre>
</header>
)}
<slot />
</body>
</html>

View file

@ -4,7 +4,7 @@ export const prerender = false;
import { getSession } from 'auth-astro/server';
import { getPendingEntries, type GuestbookEntry } from '../lib/db';
import { isAdmin } from '../lib/auth';
import '../styles/global.css';
import Layout from '../layouts/Layout.astro';
let session;
try {
@ -35,10 +35,8 @@ function formatDate(date: Date): string {
return `${d}/${m}/${y}`;
}
---
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><title>admin - guestbook</title></head>
<body>
<Layout title="admin - guestbook" showHeader={false}>
<h1>guestbook admin</h1>
<p>logged in as {session.user?.name} <a href="/api/auth/signout">sign out</a></p>
@ -92,5 +90,4 @@ function formatDate(date: Date): string {
});
});
</script>
</body>
</html>
</Layout>

View file

@ -1,6 +1,6 @@
---
import { getCollection, render } from 'astro:content';
import '../../styles/global.css';
import Layout from '../../layouts/Layout.astro';
export async function getStaticPaths() {
const posts = await getCollection('posts');
@ -13,17 +13,10 @@ export async function getStaticPaths() {
const { post } = Astro.props;
const { Content } = await render(post);
---
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><title>{post.data.title} - lewis m.w.</title></head>
<body>
<header>
<pre><a href="/">lewis m.w.</a> <a href="mailto:lewis@wynne.rs">mail</a> <a href="https://github.com/llywelwyn">gh</a></pre>
</header>
<Layout title={`${post.data.title} - lewis m.w.`}>
<article>
<h1>{post.data.title}</h1>
<Content />
</article>
</body>
</html>
</Layout>

View file

@ -1,6 +1,6 @@
---
import { getCollection } from 'astro:content';
import '../../styles/global.css';
import Layout from '../../layouts/Layout.astro';
const posts = await getCollection('posts');
const sorted = posts.sort((a, b) => {
@ -16,17 +16,10 @@ function formatDate(date: Date): string {
return `${d}/${m}/${y}`;
}
---
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><title>blog - lewis m.w.</title></head>
<body>
<header>
<pre><a href="/">lewis m.w.</a> <a href="mailto:lewis@wynne.rs">mail</a> <a href="https://github.com/llywelwyn">gh</a></pre>
</header>
<Layout title="blog - lewis m.w.">
<details open>
<summary>blog</summary>
<pre set:html={sorted.map(post => `<span class="muted">${formatDate(post.data.date)}</span> <a href="/blog/${post.id}">${post.data.title}</a>${post.data.pinned ? ' [pinned]' : ''}`).join('\n')} />
</details>
</body>
</html>
</Layout>

View file

@ -1,5 +1,5 @@
---
import '../../styles/global.css';
import Layout from '../../layouts/Layout.astro';
import yaml from 'js-yaml';
import bookmarksRaw from '../../data/bookmarks.yaml?raw';
@ -33,17 +33,10 @@ function extractDomain(url: string): string {
}
}
---
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><title>bookmarks - lewis m.w.</title></head>
<body>
<header>
<pre><a href="/">lewis m.w.</a> <a href="mailto:lewis@wynne.rs">mail</a> <a href="https://github.com/llywelwyn">gh</a></pre>
</header>
<Layout title="bookmarks - lewis m.w.">
<details open>
<summary>bookmarks</summary>
<pre set:html={bookmarks.map(b => `<span class="muted">${formatBookmarkDate(b.date)}</span> <a href="${b.url}">${b.title}</a> <span class="muted">(${extractDomain(b.url)})</span>`).join('\n')} />
</details>
</body>
</html>
</Layout>

View file

@ -1,5 +1,5 @@
---
import '../../styles/global.css';
import Layout from '../../layouts/Layout.astro';
import { getApprovedEntries, type GuestbookEntry } from '../../lib/db';
let guestbookEntries: GuestbookEntry[] = [];
@ -16,13 +16,7 @@ function formatDate(date: Date): string {
return `${d}/${m}/${y}`;
}
---
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><title>guestbook - lewis m.w.</title></head>
<body>
<header>
<pre><a href="/">lewis m.w.</a> <a href="mailto:lewis@wynne.rs">mail</a> <a href="https://github.com/llywelwyn">gh</a></pre>
</header>
<Layout title="guestbook - lewis m.w.">
<details open>
<summary>guestbook</summary>
@ -70,5 +64,4 @@ function formatDate(date: Date): string {
}
});
</script>
</body>
</html>
</Layout>

View file

@ -1,6 +1,6 @@
---
import { getCollection } from 'astro:content';
import '../styles/global.css';
import Layout from '../layouts/Layout.astro';
import yaml from 'js-yaml';
import bookmarksRaw from '../data/bookmarks.yaml?raw';
import fs from 'node:fs';
@ -68,13 +68,7 @@ function extractDomain(url: string): string {
}
}
---
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><title>lewis m.w.</title></head>
<body>
<header>
<pre>lewis m.w. <a href="mailto:lewis@wynne.rs">mail</a> <a href="https://github.com/llywelwyn">gh</a></pre>
</header>
<Layout title="lewis m.w." isHome>
<details open>
<summary>blog</summary>
@ -146,5 +140,4 @@ function extractDomain(url: string): string {
}
});
</script>
</body>
</html>
</Layout>

View file

@ -1,5 +1,5 @@
---
import '../../styles/global.css';
import Layout from '../../layouts/Layout.astro';
import fs from 'node:fs';
import path from 'node:path';
@ -26,17 +26,10 @@ function formatDate(date: Date): string {
return `${d}/${m}/${y}`;
}
---
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><title>txt - lewis m.w.</title></head>
<body>
<header>
<pre><a href="/">lewis m.w.</a> <a href="mailto:lewis@wynne.rs">mail</a> <a href="https://github.com/llywelwyn">gh</a></pre>
</header>
<Layout title="txt - lewis m.w.">
<details open>
<summary>txt</summary>
<pre set:html={txtFiles.map(f => `<span class="muted">${formatDate(f.mtime)}</span> <a href="/txt/${f.name}">${f.name}</a>`).join('\n')} />
</details>
</body>
</html>
</Layout>