File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -10,4 +10,5 @@ export default [
1010 route ( "/robots.txt" , "routes/robots/route.ts" ) ,
1111 route ( "/version" , "routes/version/route.ts" ) ,
1212 route ( "/site.webmanifest" , "routes/webmanifest/route.ts" ) ,
13+ route ( "/favicon.ico" , "routes/favicon/route.ts" ) ,
1314] satisfies RouteConfig ;
Original file line number Diff line number Diff line change 1+ import { redirect } from "react-router" ;
2+ import { getMeta } from "~/utils/cms-data.server" ;
3+ import { imagekitUrl } from "~/utils/imagekit" ;
4+ import type { Route } from "../../+types/root" ;
5+ import { getEnvironment } from "~/utils/environment.server" ;
6+ import type { Media } from "@fxmk/payload-types" ;
7+
8+ export async function loader ( { request } : Route . LoaderArgs ) {
9+ const meta = await getMeta ( ) ;
10+ const environment = getEnvironment ( request ) ;
11+
12+ if ( ! meta . faviconIco ) {
13+ return new Response ( null , { status : 404 } ) ;
14+ }
15+
16+ return redirect (
17+ `${ imagekitUrl (
18+ environment . imagekitBaseUrl ,
19+ ( meta . faviconIco as Media ) . filename ! ,
20+ [ { format : "orig" } ] ,
21+ ) } `,
22+ ) ;
23+ }
You can’t perform that action at this time.
0 commit comments