Skip to content

Commit

Permalink
refactor: improve head link definition
Browse files Browse the repository at this point in the history
  • Loading branch information
dy0gu committed Sep 16, 2024
1 parent 9f619ee commit b75aa10
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 29 deletions.
24 changes: 0 additions & 24 deletions src/data/attributes.ts

This file was deleted.

14 changes: 14 additions & 0 deletions src/data/info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Reusable values throughout the app
const info = {
name: "Dy0gu",
description: "Just an individual, writing some code on the internet.",
links: [
{ name: "GitHub", href: "https://www.github.com/dy0gu" },
{
name: "Stack Overflow",
href: "https://stackoverflow.com/users/22441488",
},
],
};

export { info };
2 changes: 1 addition & 1 deletion src/data/meta.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { env } from "~/utils/env";

import { info } from "~/data/attributes";
import { info } from "~/data/info";

// Meta tags for the <head> of the root html document
// This object uses server environment variables, meaning it can only be called in Remix loader functions
Expand Down
9 changes: 7 additions & 2 deletions src/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
Scripts,
ScrollRestoration,
} from "@remix-run/react";
import { rels } from "~/data/attributes";
import { metadata } from "~/data/meta";
import stylesheet from "~/styles/tailwind.css?url";

export function loader() {
return json(metadata);
Expand All @@ -23,7 +23,12 @@ export const meta: MetaFunction<typeof loader> = ({ data }) => {
};

export const links: LinksFunction = () => {
return rels;
return [
{ rel: "icon", href: "/favicon.svg", type: "image/svg+xml" },
{ rel: "sitemap", href: "/sitemap.xml" },
{ rel: "manifest", href: "/manifest.webmanifest" },
{ rel: "stylesheet", href: stylesheet },
];
};

export default function Layout() {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/[manifest.webmanifest].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { info } from "~/data/attributes";
import { info } from "~/data/info";

// Dynamic manifest.webmanifest generator route
export const loader = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMystery } from "~/hooks/mystery";

import { info } from "~/data/attributes";
import { info } from "~/data/info";

import { Beam } from "~/components/beam";
import { Hero, name } from "~/components/hero";
Expand Down

0 comments on commit b75aa10

Please sign in to comment.