Skip to content

refacto: moved title meta tag in pages #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions templates/next/components/foo/Form.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { FunctionComponent, useState } from "react";
import Link from "next/link";
import { useRouter } from "next/router";
import Head from "next/head";
import { ErrorMessage, Formik } from "formik";
import { fetch } from "../../utils/dataAccess";
import { {{{ucf}}} } from '../../types/{{{ucf}}}';
Expand All @@ -28,12 +27,6 @@ export const Form: FunctionComponent<Props> = ({ {{{lc}}} }) => {

return (
<div>
<div>
<Head>
<title>{ {{{lc}}} ? `Edit {{{ucf}}} ${ {{~lc}}['@id']}` : `Create {{{ucf}}}` }</title>
<meta property="og:title" content={ {{{lc}}} ? `Edit {{{ucf}}} ${ {{~lc}}['@id']}` : `Create {{{ucf}}}` } />
</Head>
</div>
<h1>{ {{{lc}}} ? `Edit {{{ucf}}} ${ {{~lc}}['@id']}` : `Create {{{ucf}}}` }</h1>
<Formik
initialValues={ {{~lc}} ? {...{{lc~}} } : new {{{ucf}}}()}
Expand Down
7 changes: 0 additions & 7 deletions templates/next/components/foo/List.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { FunctionComponent } from "react";
import Link from "next/link";
import Head from "next/head";
import ReferenceLinks from "../../components/common/ReferenceLinks";
import { {{{ucf}}} } from '../../types/{{{ucf}}}';

Expand All @@ -10,12 +9,6 @@ interface Props {

export const List: FunctionComponent<Props> = ({ {{{name}}} }) => (
<div>
<div>
<Head>
<title>{{{ucf}}} List</title>
<meta property="og:title" content="{{{ucf}}} List" key="title" />
</Head>
</div>
<h1>{{{ucf}}} List</h1>
<Link href="/{{{name}}}/create">
<a className="btn btn-primary">Create</a>
Expand Down
9 changes: 1 addition & 8 deletions templates/next/components/foo/Show.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { FunctionComponent, useState } from 'react';
import Link from 'next/link';
import Head from "next/head";
import { useRouter } from "next/router";
import { fetch } from "../../utils/dataAccess";
import { ReferenceLinks } from '../common/ReferenceLinks';
import ReferenceLinks from '../common/ReferenceLinks';
import { {{{ucf}}} } from '../../types/{{{ucf}}}';

interface Props {
Expand All @@ -28,12 +27,6 @@ export const Show: FunctionComponent<Props> = ({ {{{lc}}} }) => {

return (
<div>
<div>
<Head>
<title>{`Show {{{ucf}}} ${ {{~lc}}['@id']}`}</title>
<meta property="og:title" content={`Show {{{ucf}}} ${ {{~lc}}['@id']}`} key="title" />
</Head>
</div>
<h1>{`Show {{{ucf}}} ${ {{~lc}}['@id']}`}</h1>
<table className="table table-responsive table-striped table-hover">
<thead>
Expand Down
11 changes: 9 additions & 2 deletions templates/next/pages/foos/[id]/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ import { NextComponentType, NextPageContext } from 'next';
import { Form } from '../../../components/{{{lc}}}/Form';
import { {{{ucf}}} } from '../../../types/{{{ucf}}}';
import { fetch } from '../../../utils/dataAccess';
import Head from "next/head";

interface Props {
{{{lc}}}: {{{ucf}}};
};

const Page: NextComponentType<NextPageContext, Props, Props> = ({ {{{lc}}} }) => {

return (
<Form {{{lc}}}={ {{{lc}}} }/>
<div>
<div>
<Head>
<title>{ {{{lc}}} && `Edit {{{ucf}}} ${ {{~lc}}['@id']}`}</title>
</Head>
</div>
<Form {{{lc}}}={ {{{lc}}} }/>
</div>
);
};

Expand Down
10 changes: 9 additions & 1 deletion templates/next/pages/foos/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@ import { NextComponentType, NextPageContext } from 'next';
import { Show } from '../../../components/{{{lc}}}/Show';
import { {{{ucf}}} } from '../../../types/{{{ucf}}}';
import { fetch } from '../../../utils/dataAccess';
import Head from "next/head";

interface Props {
{{{lc}}}: {{{ucf}}};
};

const Page: NextComponentType<NextPageContext, Props, Props> = ({ {{{lc}}} }) => {
return (
<Show {{{lc}}}={ {{{lc}}} }/>
<div>
<div>
<Head>
<title>{`Show {{{ucf}}} ${ {{~lc}}['@id']}`}</title>
</Head>
</div>
<Show {{{lc}}}={ {{{lc}}} }/>
</div>
);
};

Expand Down
13 changes: 12 additions & 1 deletion templates/next/pages/foos/create.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import { NextComponentType, NextPageContext } from "next";
import { Form } from "../../components/{{{lc}}}/Form";
import Head from "next/head";

const Page: NextComponentType<NextPageContext> = () => (
<div>
<div>
<Head>
<title>Create {{{ucf}}} </title>
</Head>
</div>
<Form />
</div>
)

const Page: NextComponentType<NextPageContext> = () => <Form />;

export default Page;
10 changes: 9 additions & 1 deletion templates/next/pages/foos/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@ import { List } from '../../components/{{{lc}}}/List';
import { PagedCollection } from '../../types/Collection';
import { {{{ucf}}} } from '../../types/{{{ucf}}}';
import { fetch } from '../../utils/dataAccess';
import Head from "next/head";

interface Props {
collection: PagedCollection<{{{ucf}}}>;
}

const Page: NextComponentType<NextPageContext, Props, Props> = ({collection}) => (
<List {{{name}}}={collection['{{{hydraPrefix}}}member']}/>
<div>
<div>
<Head>
<title>{{{ucf}}} List</title>
</Head>
</div>
<List {{{name}}}={collection['{{{hydraPrefix}}}member']}/>
</div>
);

Page.getInitialProps = async () => {
Expand Down