Skip to content

Commit

Permalink
manual redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
activatedgeek committed Mar 24, 2024
1 parent 223bd23 commit 2e7acda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copernicus

[![Deploy](https://github.com/activatedgeek/copernicus/actions/workflows/pages.yml/badge.svg)](https://github.com/activatedgeek/copernicus/actions/workflows/pages.yml)
[![Deploy](https://github.com/activatedgeek/copernicus/actions/workflows/pages.yml/badge.svg)](https://github.com/activatedgeek/copernicus/actions/workflows/pages.yml) [![Better Stack Badge](https://uptime.betterstack.com/status-badges/v1/monitor/13rvh.svg)](https://status.sanyamkapoor.com/?utm_source=status_badge)

Base framework to generate my website based on [Astro](https://astro.build).
Website & knowledge base hosted at [sanyamkapoor.com](https://sanyamkapoor.com).
Expand Down
7 changes: 6 additions & 1 deletion src/pages/redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getCollection } from "astro:content";

import { processCollectionItem } from "@lib/collections";

const allRedirects = (
const kbRedirects = (
await Promise.all((await getCollection("kb")).map(processCollectionItem))
)
.map(
Expand All @@ -25,12 +25,17 @@ const allRedirects = (
)
.flat();

const manualRedirects = [["/cv", "/cv.pdf"]];

const allRedirects = [...kbRedirects, ...manualRedirects];

const redirectsTxt = allRedirects
.map((r) => [...r, "301"].join(" "))
.join("\n");

export const prerender = true;

// Cloudflare Pages redirects https://developers.cloudflare.com/pages/configuration/redirects/
export const GET: APIRoute = () => {
return new Response(redirectsTxt, {
headers: {
Expand Down

0 comments on commit 2e7acda

Please sign in to comment.