🎥 Make videos programmatically with React
SEO improvements
Jonny Burgerc78c441cc6c7
diff --git a/packages/convert/app/components/DropFileBox.tsx b/packages/convert/app/components/DropFileBox.tsxindex 7506512a3e..6b4f26580e 100644--- a/packages/convert/app/components/DropFileBox.tsx+++ b/packages/convert/app/components/DropFileBox.tsx@@ -29,7 +29,7 @@ export const DropFileBox: React.FC<{className="hidden"onChange={handleFileChange}/>- <Button onClick={() => ref.current?.click()}>Choose files</Button>+ <Button onClick={() => ref.current?.click()}>Choose file</Button></Card>);};diff --git a/packages/convert/app/components/Main.tsx b/packages/convert/app/components/Main.tsxindex aa0b7e44b1..1bc1f156cf 100644--- a/packages/convert/app/components/Main.tsx+++ b/packages/convert/app/components/Main.tsx@@ -4,7 +4,9 @@ import {Source} from '~/lib/convert-state';import {FileAvailable} from './FileAvailable';import {PickFile} from './PickFile';-export const Main: React.FC = () => {+export const Main: React.FC<{+ readonly title: string;+}> = ({title}) => {const [src, setSrc] = useState<Source | null>(TEST_FAST ? {type: 'url', url: SAMPLE_FILE} : null,);@@ -18,7 +20,7 @@ export const Main: React.FC = () => {setSrc={setSrc}/>) : (- <PickFile setSrc={setSrc} />+ <PickFile setSrc={setSrc} title={title} />)}</div>);diff --git a/packages/convert/app/components/PickFile.tsx b/packages/convert/app/components/PickFile.tsxindex 3a2fad2d2b..0f36857b0d 100644--- a/packages/convert/app/components/PickFile.tsx+++ b/packages/convert/app/components/PickFile.tsx@@ -5,7 +5,8 @@ import {DropFileBox} from './DropFileBox';export const PickFile: React.FC<{readonly setSrc: React.Dispatch<React.SetStateAction<Source | null>>;-}> = ({setSrc}) => {+ readonly title: string;+}> = ({setSrc, title}) => {const onSampleFile = useCallback(() => {setSrc({type: 'url', url: SAMPLE_FILE});}, [setSrc]);@@ -31,9 +32,7 @@ export const PickFile: React.FC<{onDragOver={onDragOver}onDrop={onDrop}>- <h1 className="text-center text-4xl font-brand font-bold">- Fast video conversion in the browser- </h1>+ <h1 className="text-center text-4xl font-brand font-bold">{title}</h1><div className="h-12" /><DropFileBox setSrc={setSrc} /><div className="h-4" />diff --git a/packages/convert/app/root.tsx b/packages/convert/app/root.tsxindex 760144b62a..73d217fa1c 100644--- a/packages/convert/app/root.tsx+++ b/packages/convert/app/root.tsx@@ -1,10 +1,4 @@-import {- Links,- Meta,- Outlet,- Scripts,- ScrollRestoration,-} from '@remix-run/react';+import {Links, Outlet, Scripts, ScrollRestoration} from '@remix-run/react';import './tailwind.css';export function Layout({children}: {readonly children: React.ReactNode}) {@@ -13,7 +7,11 @@ export function Layout({children}: {readonly children: React.ReactNode}) {<head><meta charSet="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />- <Meta />+ <title>Remotion Convert</title>+ <meta+ name="description"+ content="Fast video conversion in the browser."+ /><Links /></head><body>diff --git a/packages/convert/app/routes/_index.tsx b/packages/convert/app/routes/_index.tsxindex 1cf2d7dc95..c9c7b3e39e 100644--- a/packages/convert/app/routes/_index.tsx+++ b/packages/convert/app/routes/_index.tsx@@ -1,15 +1,7 @@-import type {MetaFunction} from '@remix-run/node';import {Main} from '~/components/Main';-export const meta: MetaFunction = () => {- return [- {title: 'Remotion Convert'},- {name: 'description', content: 'Fast video conversion in the browser.'},- ];-};-const Index = () => {- return <Main />;+ return <Main title="Fast video conversion in the browser" />;};export default Index;diff --git a/packages/convert/app/routes/convert-mp4-to-webm.tsx b/packages/convert/app/routes/convert-mp4-to-webm.tsxnew file mode 100644index 0000000000..cb04dd7b22--- /dev/null+++ b/packages/convert/app/routes/convert-mp4-to-webm.tsx@@ -0,0 +1,7 @@+import {Main} from '~/components/Main';++const Index = () => {+ return <Main title="Fast MP4 to WebM conversion in the browser" />;+};++export default Index;diff --git a/packages/convert/app/routes/convert.tsx b/packages/convert/app/routes/convert.tsxindex 1cf2d7dc95..c9c7b3e39e 100644--- a/packages/convert/app/routes/convert.tsx+++ b/packages/convert/app/routes/convert.tsx@@ -1,15 +1,7 @@-import type {MetaFunction} from '@remix-run/node';import {Main} from '~/components/Main';-export const meta: MetaFunction = () => {- return [- {title: 'Remotion Convert'},- {name: 'description', content: 'Fast video conversion in the browser.'},- ];-};-const Index = () => {- return <Main />;+ return <Main title="Fast video conversion in the browser" />;};export default Index;diff --git a/packages/docs/copy-convert.ts b/packages/docs/copy-convert.tsindex 2a610f1bb4..127fb671a3 100644--- a/packages/docs/copy-convert.ts+++ b/packages/docs/copy-convert.ts@@ -7,3 +7,12 @@ await $`bunx turbo "@remotion/convert#build-spa"`;const dir = path.join(__dirname, '../convert/spa-dist/client');fs.cpSync(dir, path.join(__dirname, './build/convert'), {recursive: true});++const extraSlugs = ['convert-mp4-to-webm'];+for (const slug of extraSlugs) {+ const out = path.join(__dirname, `./build/${slug}/index.html`);+ if (!fs.existsSync(path.dirname(out))) {+ fs.mkdirSync(path.dirname(out), {recursive: true});+ }+ fs.copyFileSync(path.join(dir, 'index.html'), out);+}