Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kremalicious committed Sep 11, 2023
1 parent 42a73be commit ace17be
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 73 deletions.
70 changes: 0 additions & 70 deletions .aws/redirects.xml

This file was deleted.

74 changes: 74 additions & 0 deletions .config/aws_redirects.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<!--
AWS S3 routing rules for old content
needs to be manually added to S3 bucket
-->
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>lab/</KeyPrefixEquals>
</Condition>
<Redirect>
<HostName>lab.kremalicious.com</HostName>
<ReplaceKeyWith></ReplaceKeyWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>lab</KeyPrefixEquals>
</Condition>
<Redirect>
<HostName>lab.kremalicious.com</HostName>
<ReplaceKeyWith></ReplaceKeyWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>csspaperstack/</KeyPrefixEquals>
</Condition>
<Redirect>
<HostName>lab.kremalicious.com</HostName>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>csspaperstack</KeyPrefixEquals>
</Condition>
<Redirect>
<HostName>lab.kremalicious.com</HostName>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>download/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyPrefixWith>media/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>feed/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyPrefixWith>feed.xml</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>portfolio/</KeyPrefixEquals>
</Condition>
<Redirect>
<HostName>matthiaskretschmann.com</HostName>
<ReplaceKeyWith></ReplaceKeyWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<KeyPrefixEquals>portfolio</KeyPrefixEquals>
</Condition>
<Redirect>
<HostName>matthiaskretschmann.com</HostName>
<ReplaceKeyWith></ReplaceKeyWith>
</Redirect>
</RoutingRule>
</RoutingRules>
2 changes: 1 addition & 1 deletion .config/blog.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
},
rss: '/feed.xml',
jsonfeed: '/feed.json',
itemsPerPage: 24,
itemsPerPage: 30,
repoContentPath: 'https://github.com/kremalicious/blog/tree/main/content',
menu: [
{
Expand Down
3 changes: 2 additions & 1 deletion src/pages/archive/[page].astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
import { loadAndFormatCollection } from '@lib/astro'
import type { GetStaticPathsOptions, InferGetStaticPropsType } from 'astro'
import LayoutArchive from '@components/layouts/Archive.astro'
import config from '@config/blog.config'
type Props = InferGetStaticPropsType<typeof getStaticPaths>
export async function getStaticPaths({ paginate }: GetStaticPathsOptions) {
const articles = await loadAndFormatCollection('articles')
const links = await loadAndFormatCollection('links')
return paginate([...articles, ...links], { pageSize: 30 })
return paginate([...articles, ...links], { pageSize: config.itemsPerPage })
}
// All paginated data + posts are passed on the "page" prop
const { page } = Astro.props as Props
Expand Down
3 changes: 2 additions & 1 deletion src/pages/photos/[page].astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
import type { GetStaticPathsOptions, InferGetStaticPropsType } from 'astro'
import { loadAndFormatCollection } from '@lib/astro'
import LayoutArchive from '@components/layouts/Archive.astro'
import config from '@config/blog.config'
type Props = InferGetStaticPropsType<typeof getStaticPaths>
export async function getStaticPaths({ paginate }: GetStaticPathsOptions) {
const photos = await loadAndFormatCollection('photos')
return paginate(photos, { pageSize: 30 })
return paginate(photos, { pageSize: config.itemsPerPage })
}
// All paginated data is passed on the "page" prop
Expand Down

0 comments on commit ace17be

Please sign in to comment.