Skip to content

Commit

Permalink
add no index tags
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodingwizard committed Sep 2, 2024
1 parent 0213c66 commit 7918340
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 13 deletions.
12 changes: 10 additions & 2 deletions pages/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import useUserFileConnection from '../src/hooks/useUserFileConnection';
import useUpdateUserDashboard from '../src/hooks/useUpdateUserDashboard';
import { ConfirmOverrideModal } from '../src/components/ConfirmOverrideModal';
import Link from 'next/link';
import Head from 'next/head';

function EditorPage() {
const { fileData, updateFileData } = useEditorContext();
Expand Down Expand Up @@ -268,7 +269,9 @@ export default function FilePage() {

const { userData } = useNullableUserContext();

const loadingUI = <MessagePage message="Loading..." showHomeButton={false} />;
const loadingUI = (
<MessagePage message="Loading..." showHomeButton={false} noIndex />
);
const oldLink = `https://legacy.ide.usaco.guide/${queryId}`;
const fileNotFoundUI = (
<div className="p-8 sm:p-16">
Expand All @@ -293,13 +296,18 @@ export default function FilePage() {
</div>
</div>
);
const permissionDeniedUI = <MessagePage message="This file is private." />;
const permissionDeniedUI = (
<MessagePage message="This file is private." noIndex />
);

if (!queryId) return null;
if (!userData) return loadingUI;

return (
<>
<Head>
<meta name="robots" content="noindex,nofollow" />
</Head>
<EditorProvider
fileId={firebaseFileID}
loadingUI={loadingUI}
Expand Down
6 changes: 4 additions & 2 deletions pages/[id]/copy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ export default function CopyFilePage(): JSX.Element {
}, [router.isReady, firebaseUser]);

if (error) {
return <MessagePage message={'Error: ' + error} />;
return <MessagePage message={'Error: ' + error} noIndex />;
}

return <MessagePage message="Copying file..." showHomeButton={false} />;
return (
<MessagePage message="Copying file..." showHomeButton={false} noIndex />
);
}
12 changes: 8 additions & 4 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ import {
useUserContext,
} from '../src/context/UserContext';
import Image from 'next/image';
import Head from 'next/head';

export default function DashboardPage(): JSX.Element {
const { userData } = useNullableUserContext();

useEffect(() => {
document.title = 'Real-Time Collaborative Online IDE';
}, []);

return (
<div className="min-h-full flex flex-col">
<Head>
<title>Real-Time Collaborative Online IDE</title>
<meta
name="description"
content="An online IDE designed for competitive programming, with code execution, intellisense, mobile support, realtime collaborative editing, and built-in USACO submissions."
/>
</Head>
<ConfirmOverrideModal />
<div className="flex-1">
<div className="p-4 sm:p-6 md:p-8 lg:p-12 max-w-6xl mx-auto">
Expand Down
11 changes: 8 additions & 3 deletions pages/n.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { useAtomValue } from 'jotai/utils';
import { useRouter } from 'next/router';
import React, { useEffect, useRef } from 'react';
import invariant from 'tiny-invariant';
import { MessagePage } from '../src/components/MessagePage';
import { useNullableUserContext } from '../src/context/UserContext';
import { DEFAULT_COMPILER_OPTIONS } from './new';
import va from '@vercel/analytics';
import Head from 'next/head';

export default function NewFilePage() {
const { userData, firebaseUser } = useNullableUserContext();
Expand Down Expand Up @@ -42,5 +41,11 @@ export default function NewFilePage() {
}
}, [userData, firebaseUser]);

return <MessagePage showHomeButton={false} message="Creating new file..." />;
return (
<MessagePage
showHomeButton={false}
message="Creating new file..."
noIndex
/>
);
}
5 changes: 5 additions & 0 deletions pages/new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import firebase from 'firebase/app';
import { SharingPermissions } from '../src/components/SharingPermissions';
import va from '@vercel/analytics';
import generateRandomFileName from '../src/scripts/generateRandomFileName';
import Head from 'next/head';

function classNames(...classes: any[]) {
return classes.filter(Boolean).join(' ');
Expand Down Expand Up @@ -107,6 +108,10 @@ export default function NewFilePage() {

return (
<div className="p-4 sm:p-6 md:p-8 lg:p-12 min-h-full flex flex-col max-w-6xl mx-auto">
<Head>
<title>Create New File · Real-Time Collaborative Online IDE</title>
<meta name="robots" content="noindex,nofollow" />
</Head>
<form className="space-y-6 sm:space-y-8" onSubmit={handleSubmit}>
<h1 className="text-white font-semibold md:text-xl xl:text-2xl">
Create New File
Expand Down
6 changes: 4 additions & 2 deletions pages/usaco/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ export default function CreateUSACO(): JSX.Element {
}, [router.isReady, firebaseUser, userData]);

if (error) {
return <MessagePage message={'Error: ' + error} />;
return <MessagePage message={'Error: ' + error} noIndex />;
}

return <MessagePage message="Loading File..." showHomeButton={false} />;
return (
<MessagePage message="Loading File..." showHomeButton={false} noIndex />
);
}
6 changes: 6 additions & 0 deletions src/components/MessagePage.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import React from 'react';
import Link from 'next/link';
import Head from 'next/head';

export const MessagePage = ({
message,
showHomeButton = true,
noIndex = false,
}: {
message: string;
showHomeButton?: boolean;
noIndex?: boolean;
}): JSX.Element => {
return (
<div className="p-8 sm:p-16 text-center">
<Head>
{noIndex && <meta name="robots" content="noindex,nofollow" />}
</Head>
<div className="text-3xl sm:text-4xl text-white font-bold">{message}</div>
{showHomeButton && (
<Link
Expand Down

0 comments on commit 7918340

Please sign in to comment.