Improved tagging
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
---
|
||||
const pageTitle = Astro.props.title || "Corwin Perren";
|
||||
const pageTitle = Astro.props.title ? `${Astro.props.title} - Corwin Perren`: "Corwin Perren";
|
||||
---
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="icon" type="image/png" href="/favicon.png"/>
|
||||
<meta name="viewport" content="width=device-width"/>
|
||||
<meta name="generator" content={Astro.generator}/>
|
||||
<title>{pageTitle}</title>
|
||||
</head>
|
||||
<body class="container mx-auto">
|
||||
<h1>{pageTitle}</h1>
|
||||
<slot/>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,22 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<title>Corwin Perren</title>
|
||||
</head>
|
||||
<body>
|
||||
<slot />
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -1,17 +1,18 @@
|
||||
---
|
||||
import { getCollection, render } from 'astro:content';
|
||||
import {getCollection, render} from 'astro:content';
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
// 1. Generate a new path for every collection entry
|
||||
export async function getStaticPaths() {
|
||||
const hobbies = await getCollection('hobbies');
|
||||
return hobbies.map(hobby => ({
|
||||
params: { id: hobby.id },
|
||||
props: { hobby: hobby },
|
||||
params: {id: hobby.id},
|
||||
props: {hobby: hobby, title: hobby.id},
|
||||
}));
|
||||
}
|
||||
// 2. For your template, you can get the entry directly from the prop
|
||||
const { hobby } = Astro.props;
|
||||
const { Content } = await render(hobby);
|
||||
|
||||
const {hobby} = Astro.props;
|
||||
const {Content} = await render(hobby);
|
||||
---
|
||||
<h1>{hobby.id}</h1>
|
||||
<Content />
|
||||
<BaseLayout title={hobby.id}>
|
||||
<Content/>
|
||||
</BaseLayout>
|
||||
@@ -1,23 +1,27 @@
|
||||
---
|
||||
import { getCollection } from 'astro:content';
|
||||
import {getCollection} from 'astro:content';
|
||||
import BaseLayout from "../layouts/BaseLayout.astro";
|
||||
|
||||
const projects = await getCollection('projects');
|
||||
const hobbies = await getCollection('hobbies');
|
||||
---
|
||||
<h1>My Projects</h1>
|
||||
<ul>
|
||||
{projects.map(project => (
|
||||
<li><a href={`/project/${project.id}`}>{project.id}</a></li>
|
||||
))}
|
||||
</ul>
|
||||
<BaseLayout>
|
||||
<h1>My Projects</h1>
|
||||
<ul>
|
||||
{projects.map(project => (
|
||||
<li><a href={`/project/${project.id}`}>{project.id}</a></li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
<h1>My Hobbies</h1>
|
||||
<ul>
|
||||
{hobbies.map(project => (
|
||||
<li><a href={`/hobby/${project.id}`}>{project.id}</a></li>
|
||||
))}
|
||||
</ul>
|
||||
</BaseLayout>
|
||||
|
||||
<h1>My Hobbies</h1>
|
||||
<ul>
|
||||
{hobbies.map(project => (
|
||||
<li><a href={`/hobby/${project.id}`}>{project.id}</a></li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
<!--import BaseLayout from "../layouts/BaseLayout.astro";-->
|
||||
<!--import { getCollection, render } from 'astro:content';-->
|
||||
<!--import type { CollectionEntry } from 'astro:content';-->
|
||||
|
||||
@@ -46,4 +50,3 @@ const hobbies = await getCollection('hobbies');
|
||||
<!--<!– <div class="prose">–>-->
|
||||
<!--<!– <!–<Content />–>–>-->
|
||||
<!--<!– </div>–>-->
|
||||
<!--</BaseLayout>-->
|
||||
@@ -1,17 +1,18 @@
|
||||
---
|
||||
import { getCollection, render } from 'astro:content';
|
||||
import {getCollection, render} from 'astro:content';
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
// 1. Generate a new path for every collection entry
|
||||
export async function getStaticPaths() {
|
||||
const projects = await getCollection('projects');
|
||||
return projects.map(project => ({
|
||||
params: { id: project.id },
|
||||
props: { project: project },
|
||||
params: {id: project.id},
|
||||
props: {project: project},
|
||||
}));
|
||||
}
|
||||
// 2. For your template, you can get the entry directly from the prop
|
||||
const { project } = Astro.props;
|
||||
const { Content } = await render(project);
|
||||
|
||||
const {project} = Astro.props;
|
||||
const {Content} = await render(project);
|
||||
---
|
||||
<h1>{project.id}</h1>
|
||||
<Content />
|
||||
<BaseLayout title={project.id}>
|
||||
<Content/>
|
||||
</BaseLayout>
|
||||
Reference in New Issue
Block a user