mirror of
https://github.com/kogakure/website-astro-stefanimhoff.de.git
synced 2026-02-03 20:15:27 +00:00
feat: remove AI art
This commit is contained in:
committed by
Stefan Imhoff
parent
ae5249359d
commit
8f371d9830
@@ -1,80 +0,0 @@
|
||||
---
|
||||
import type { CollectionEntry } from 'astro:content';
|
||||
type AiArt = CollectionEntry<'ai-art'>;
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
import { sortBySortKey } from '../utils';
|
||||
|
||||
import GridLayout from '../layouts/GridLayout.astro';
|
||||
import PageTitle from '../components/PageTitle.astro';
|
||||
import Image from '../components/Image.astro';
|
||||
import Link from '../components/Link.astro';
|
||||
import { Content as Intro } from '../text/ai-art/intro.mdx';
|
||||
|
||||
import { mapping } from '../mdx-components';
|
||||
|
||||
const allAiArt: AiArt[] = await getCollection('ai-art');
|
||||
allAiArt.sort(sortBySortKey);
|
||||
|
||||
const title = 'AI Art';
|
||||
const description = 'This is a collection of AI art pieces I’ve created with Stable Diffusion.';
|
||||
---
|
||||
|
||||
<GridLayout title={title} description={description} grid="wide" backLink="/" class="grid" innerGrid>
|
||||
<PageTitle grid="wide" innerGrid>AI Art</PageTitle>
|
||||
|
||||
<article
|
||||
class="col-start-1 col-end-18 grid md:col-start-4 md:col-end-12 xl:col-start-5 xl:col-end-11"
|
||||
>
|
||||
<Intro components={mapping} />
|
||||
</article>
|
||||
|
||||
<nav
|
||||
aria-label="AI Art"
|
||||
class="col-start-1 col-end-18 md:col-start-1 md:col-end-16"
|
||||
data-pagefind-ignore
|
||||
>
|
||||
<ol
|
||||
class="gap-[max(25px,_2vw)] md:grid md:grid-flow-row-dense md:auto-rows-[50px] md:grid-cols-[repeat(auto-fit,_minmax(50px,_1fr))] md:grid-rows-[50px]"
|
||||
>
|
||||
{
|
||||
allAiArt.map(({ slug, data }) => (
|
||||
<li
|
||||
style={{ aspectRatio: data.images[0].aspectRatio }}
|
||||
class:list={[
|
||||
{
|
||||
'md:col-span-3 md:row-span-2':
|
||||
data.images[0].aspectRatio > 1 && data.coverSize === 'small',
|
||||
'md:col-span-2 md:row-span-3':
|
||||
data.images[0].aspectRatio < 1 && data.coverSize === 'small',
|
||||
'md:col-span-3 md:row-span-3':
|
||||
data.images[0].aspectRatio === 1 && data.coverSize === 'small',
|
||||
'md:col-span-4 md:row-span-3':
|
||||
data.images[0].aspectRatio > 1 && data.coverSize === 'medium',
|
||||
'md:col-span-3 md:row-span-5':
|
||||
data.images[0].aspectRatio < 1 && data.coverSize === 'medium',
|
||||
'md:col-span-4 md:row-span-4':
|
||||
data.images[0].aspectRatio === 1 && data.coverSize === 'medium',
|
||||
'md:col-span-6 md:row-span-5':
|
||||
data.images[0].aspectRatio > 1 && data.coverSize === 'large',
|
||||
'md:col-span-5 md:row-span-8':
|
||||
data.images[0].aspectRatio < 1 && data.coverSize === 'large',
|
||||
'md:col-span-6 md:row-span-6':
|
||||
data.images[0].aspectRatio === 1 && data.coverSize === 'large',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Link title={data.title} href={`/ai-art/${slug}/`}>
|
||||
<Image
|
||||
alt={data.title}
|
||||
class="h-full mbe-10 md:w-full md:object-cover md:!mbe-0 [&_img]:!block [&_img]:!h-full [&_img]:border-solid [&_picture]:!block [&_picture]:!h-full"
|
||||
loading="eager"
|
||||
src={data.images[0].src}
|
||||
/>
|
||||
</Link>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ol>
|
||||
</nav>
|
||||
</GridLayout>
|
||||
@@ -1,55 +0,0 @@
|
||||
---
|
||||
import type { CollectionEntry } from 'astro:content';
|
||||
type AiArt = CollectionEntry<'ai-art'>;
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
import { sortBySortKey } from '../../utils';
|
||||
|
||||
import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||
import PageHeader from '../../components/PageHeader.astro';
|
||||
import Pagination from '../../components/Pagination.astro';
|
||||
import GalleryDetail from '../../components/GalleryDetail.astro';
|
||||
|
||||
import { mapping } from '../../mdx-components';
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const aiArtEntries: AiArt[] = await getCollection('ai-art');
|
||||
const numberOfPages = aiArtEntries.length;
|
||||
aiArtEntries.sort(sortBySortKey).reverse();
|
||||
|
||||
return aiArtEntries.map((entry, index) => ({
|
||||
params: { slug: entry.slug },
|
||||
props: {
|
||||
entry,
|
||||
next:
|
||||
index + 1 === numberOfPages ? { slug: null, data: null } : aiArtEntries[index + 1],
|
||||
prev: index === 0 ? {} : aiArtEntries[index - 1],
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
const { entry, prev, next } = Astro.props;
|
||||
const { Content } = await entry.render();
|
||||
|
||||
const title = entry.data.title;
|
||||
const description = `The AI generated art for "${entry.data.title}".`;
|
||||
---
|
||||
|
||||
<BaseLayout title={title} description={description} header={false} footer={false}>
|
||||
<div class="grid h-full grid-cols-18">
|
||||
<PageHeader
|
||||
class="z-10 col-span-full row-start-1 bg-transparent !mbe-0 dark:bg-transparent"
|
||||
navigation={false}
|
||||
backLink="/ai-art/"
|
||||
/>
|
||||
<GalleryDetail entry={entry}>
|
||||
<Content components={mapping} />
|
||||
</GalleryDetail>
|
||||
<Pagination
|
||||
nextText={'Next'}
|
||||
nextUrl={next.slug && `/ai-art/${next.slug}`}
|
||||
previousText={'Next'}
|
||||
previousUrl={prev.slug && `/ai-art/${prev.slug}`}
|
||||
/>
|
||||
</div>
|
||||
</BaseLayout>
|
||||
@@ -1,27 +0,0 @@
|
||||
import rss from '@astrojs/rss';
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
import { site } from '../data/site';
|
||||
import { sortBySortKey } from '../utils';
|
||||
|
||||
export async function get(context) {
|
||||
const aiArt = await getCollection('ai-art');
|
||||
aiArt.sort(sortBySortKey);
|
||||
|
||||
return rss({
|
||||
stylesheet: '/rss.xsl',
|
||||
title: `${site.title} (AI Art)`,
|
||||
description: 'This is a collection of AI art pieces I’ve created with Stable Diffusion.',
|
||||
site: context.site,
|
||||
items: aiArt.map((item) => ({
|
||||
title: item.data.title,
|
||||
pubDate: item.data.date,
|
||||
customData: '<language>en-us</language>',
|
||||
link: `/ai-art/${item.slug}/`,
|
||||
content: `<div>${item.data.images
|
||||
.map((img) => `<img alt="${item.data.title}" src="${img.src}" />`)
|
||||
.join('')}</div>`,
|
||||
})),
|
||||
customData: `<language>en-us</language>`,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user