feat: add meta data (#105)

This commit is contained in:
Takeshi Kimata
2024-11-23 13:45:45 +09:00
committed by GitHub
parent 19889e0b03
commit 6ed6865a01
15 changed files with 114 additions and 6 deletions

View File

@@ -111,7 +111,6 @@
"your_projects": "Your Projects", "your_projects": "Your Projects",
"public": "Public", "public": "Public",
"private": "Private", "private": "Private",
"no_projects_found": "No projects found",
"not_own_any_projects": "You don't own any projects.", "not_own_any_projects": "You don't own any projects.",
"find_projects": "Find projects" "find_projects": "Find projects"
}, },
@@ -134,7 +133,7 @@
"at_least": "At least one administrator is required" "at_least": "At least one administrator is required"
}, },
"Projects": { "Projects": {
"projectList": "Project List", "project_list": "Project List",
"new_project": "New Project", "new_project": "New Project",
"id": "ID", "id": "ID",
"publicity": "Publicity", "publicity": "Publicity",
@@ -146,6 +145,7 @@
"no_projects_found": "No projects found" "no_projects_found": "No projects found"
}, },
"Project": { "Project": {
"project": "Project",
"home": "Home", "home": "Home",
"test_cases": "Test Cases", "test_cases": "Test Cases",
"test_runs": "Test Runs", "test_runs": "Test Runs",
@@ -153,6 +153,7 @@
"settings": "Settings" "settings": "Settings"
}, },
"Home": { "Home": {
"home": "Home",
"Folders": "Folders", "Folders": "Folders",
"test_cases": "Test Cases", "test_cases": "Test Cases",
"test_runs": "Test Runs", "test_runs": "Test Runs",

View File

@@ -134,7 +134,7 @@
"at_least": "最低1人以上の管理者が必要です。" "at_least": "最低1人以上の管理者が必要です。"
}, },
"Projects": { "Projects": {
"projectList": "プロジェクト一覧", "project_list": "プロジェクト一覧",
"new_project": "新規プロジェクト", "new_project": "新規プロジェクト",
"id": "ID", "id": "ID",
"publicity": "公開", "publicity": "公開",
@@ -146,6 +146,7 @@
"no_projects_found": "プロジェクトがありません" "no_projects_found": "プロジェクトがありません"
}, },
"Project": { "Project": {
"project": "プロジェクト",
"home": "ホーム", "home": "ホーム",
"test_cases": "テストケース", "test_cases": "テストケース",
"test_runs": "テストラン", "test_runs": "テストラン",
@@ -153,6 +154,7 @@
"settings": "設定" "settings": "設定"
}, },
"Home": { "Home": {
"home": "ホーム",
"Folders": "フォルダー", "Folders": "フォルダー",
"test_cases": "テストケース", "test_cases": "テストケース",
"test_runs": "テストラン", "test_runs": "テストラン",

View File

@@ -1,3 +1,14 @@
import { LocaleCodeType } from '@/types/locale';
import { getTranslations } from 'next-intl/server';
export async function generateMetadata({ params: { locale } }: { params: { locale: LocaleCodeType } }) {
const t = await getTranslations({ locale, namespace: 'Auth' });
return {
title: `${t('account')} | UnitTCMS`,
robots: { index: false, follow: false },
};
}
export default function AuthLayout({ children }: { children: React.ReactNode }) { export default function AuthLayout({ children }: { children: React.ReactNode }) {
return ( return (
<> <>

View File

@@ -9,7 +9,6 @@ export default function Page({ params }: PageType) {
yourProjects: t('your_projects'), yourProjects: t('your_projects'),
public: t('public'), public: t('public'),
private: t('private'), private: t('private'),
noProjectsFound: t('no_projects_found'),
notOwnAnyProjects: t('not_own_any_projects'), notOwnAnyProjects: t('not_own_any_projects'),
findProjects: t('find_projects'), findProjects: t('find_projects'),
}; };

View File

@@ -1,8 +1,17 @@
import { PageType } from '@/types/base'; import { PageType } from '@/types/base';
import AuthPage from '../authPage'; import AuthPage from '../authPage';
import { getTranslations } from 'next-intl/server';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { LocaleCodeType } from '@/types/locale'; import { LocaleCodeType } from '@/types/locale';
export async function generateMetadata({ params: { locale } }: { params: { locale: LocaleCodeType } }) {
const t = await getTranslations({ locale, namespace: 'Auth' });
return {
title: `${t('signin')} | UnitTCMS`,
robots: { index: false, follow: false },
};
}
export default function Page({ params }: PageType) { export default function Page({ params }: PageType) {
const t = useTranslations('Auth'); const t = useTranslations('Auth');
const messages = { const messages = {

View File

@@ -1,8 +1,17 @@
import { PageType } from '@/types/base'; import { PageType } from '@/types/base';
import AuthPage from '../authPage'; import AuthPage from '../authPage';
import { getTranslations } from 'next-intl/server';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { LocaleCodeType } from '@/types/locale'; import { LocaleCodeType } from '@/types/locale';
export async function generateMetadata({ params: { locale } }: { params: { locale: LocaleCodeType } }) {
const t = await getTranslations({ locale, namespace: 'Auth' });
return {
title: `${t('signup')} | UnitTCMS`,
robots: { index: false, follow: false },
};
}
export default function Page({ params }: PageType) { export default function Page({ params }: PageType) {
const t = useTranslations('Auth'); const t = useTranslations('Auth');
const messages = { const messages = {

View File

@@ -1,9 +1,18 @@
import { getTranslations } from 'next-intl/server';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import AdminPage from './AdminPage'; import AdminPage from './AdminPage';
import { PageType } from '@/types/base'; import { PageType } from '@/types/base';
import { LocaleCodeType } from '@/types/locale'; import { LocaleCodeType } from '@/types/locale';
import { AdminMessages } from '@/types/user'; import { AdminMessages } from '@/types/user';
export async function generateMetadata({ params: { locale } }: { params: { locale: LocaleCodeType } }) {
const t = await getTranslations({ locale, namespace: 'Admin' });
return {
title: `${t('user_management')} | UnitTCMS`,
robots: { index: false, follow: false },
};
}
export default function Page({ params }: PageType) { export default function Page({ params }: PageType) {
const t = useTranslations('Admin'); const t = useTranslations('Admin');
const messages: AdminMessages = { const messages: AdminMessages = {

View File

@@ -6,17 +6,26 @@ import clsx from 'clsx';
import { getTranslations } from 'next-intl/server'; import { getTranslations } from 'next-intl/server';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { LocaleCodeType } from '@/types/locale'; import { LocaleCodeType } from '@/types/locale';
import { headers } from 'next/headers';
export async function generateMetadata({ params: { locale } }: { params: { locale: LocaleCodeType } }) { export async function generateMetadata({ params: { locale } }: { params: { locale: LocaleCodeType } }) {
const headersList = headers();
const host = headersList.get('host');
const isOfficialDomain = host === 'unittcms.org' ? true : false;
const t = await getTranslations({ locale, namespace: 'Header' }); const t = await getTranslations({ locale, namespace: 'Header' });
return { return {
title: t('title'), title: `${t('title')} | UnitTCMS`,
description: t('description'), description: t('description'),
icons: { icons: {
icon: '/favicon/favicon.ico', icon: '/favicon/favicon.ico',
shortcut: '/favicon/favicon-16x16.png', shortcut: '/favicon/favicon-16x16.png',
apple: '/favicon/apple-touch-icon.png', apple: '/favicon/apple-touch-icon.png',
}, },
alternates: {
canonical: `https://www.unittcms.org/${locale}`,
},
robots: isOfficialDomain ? { index: true, follow: true } : { index: false, follow: true },
}; };
} }

View File

@@ -1,8 +1,17 @@
import { PriorityMessages } from '@/types/priority'; import { PriorityMessages } from '@/types/priority';
import CasesPane from './CasesPane'; import CasesPane from './CasesPane';
import { getTranslations } from 'next-intl/server';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { LocaleCodeType } from '@/types/locale'; import { LocaleCodeType } from '@/types/locale';
export async function generateMetadata({ params: { locale } }: { params: { locale: LocaleCodeType } }) {
const t = await getTranslations({ locale, namespace: 'Cases' });
return {
title: `${t('test_case_list')} | UnitTCMS`,
robots: { index: false, follow: false },
};
}
export default function Page({ params }: { params: { projectId: string; folderId: string; locale: string } }) { export default function Page({ params }: { params: { projectId: string; folderId: string; locale: string } }) {
const t = useTranslations('Cases'); const t = useTranslations('Cases');
const messages = { const messages = {

View File

@@ -1,4 +1,6 @@
import { LocaleCodeType } from '@/types/locale';
import { ProjectHome } from './ProjectHome'; import { ProjectHome } from './ProjectHome';
import { getTranslations } from 'next-intl/server';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { PriorityMessages } from '@/types/priority'; import { PriorityMessages } from '@/types/priority';
import { TestTypeMessages } from '@/types/testType'; import { TestTypeMessages } from '@/types/testType';
@@ -14,6 +16,14 @@ export type HomeMessages = {
byPriority: string; byPriority: string;
}; };
export async function generateMetadata({ params: { locale } }: { params: { locale: LocaleCodeType } }) {
const t = await getTranslations({ locale, namespace: 'Home' });
return {
title: `${t('home')} | UnitTCMS`,
robots: { index: false, follow: false },
};
}
export default function Page({ params }: { params: { projectId: string } }) { export default function Page({ params }: { params: { projectId: string } }) {
const t = useTranslations('Home'); const t = useTranslations('Home');
const messages = { const messages = {

View File

@@ -1,6 +1,16 @@
import { LocaleCodeType } from '@/types/locale';
import MembersPage from './MembersPage'; import MembersPage from './MembersPage';
import { getTranslations } from 'next-intl/server';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
export async function generateMetadata({ params: { locale } }: { params: { locale: LocaleCodeType } }) {
const t = await getTranslations({ locale, namespace: 'Members' });
return {
title: `${t('member_management')} | UnitTCMS`,
robots: { index: false, follow: false },
};
}
export default function Page({ params }: { params: { projectId: string; locale: string } }) { export default function Page({ params }: { params: { projectId: string; locale: string } }) {
const t = useTranslations('Members'); const t = useTranslations('Members');
const messages = { const messages = {

View File

@@ -1,7 +1,16 @@
import { LocaleCodeType } from '@/types/locale'; import { LocaleCodeType } from '@/types/locale';
import RunsPage from './RunsPage'; import RunsPage from './RunsPage';
import { getTranslations } from 'next-intl/server';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
export async function generateMetadata({ params: { locale } }: { params: { locale: LocaleCodeType } }) {
const t = await getTranslations({ locale, namespace: 'Runs' });
return {
title: `${t('run_list')} | UnitTCMS`,
robots: { index: false, follow: false },
};
}
export default function Page({ params }: { params: { projectId: string; locale: string } }) { export default function Page({ params }: { params: { projectId: string; locale: string } }) {
const t = useTranslations('Runs'); const t = useTranslations('Runs');
const messages = { const messages = {

View File

@@ -1,8 +1,18 @@
import { LocaleCodeType } from '@/types/locale';
import { ProjectDialogMessages } from '@/types/project'; import { ProjectDialogMessages } from '@/types/project';
import SettingsPage from './SettingsPage'; import SettingsPage from './SettingsPage';
import { getTranslations } from 'next-intl/server';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { SettingsMessages } from '@/types/settings'; import { SettingsMessages } from '@/types/settings';
export async function generateMetadata({ params: { locale } }: { params: { locale: LocaleCodeType } }) {
const t = await getTranslations({ locale, namespace: 'Settings' });
return {
title: `${t('project_management')} | UnitTCMS`,
robots: { index: false, follow: false },
};
}
export default function Page({ params }: { params: { projectId: string; locale: string } }) { export default function Page({ params }: { params: { projectId: string; locale: string } }) {
const t = useTranslations('Settings'); const t = useTranslations('Settings');
const messages: SettingsMessages = { const messages: SettingsMessages = {

View File

@@ -1,3 +1,14 @@
import { LocaleCodeType } from '@/types/locale';
import { getTranslations } from 'next-intl/server';
export async function generateMetadata({ params: { locale } }: { params: { locale: LocaleCodeType } }) {
const t = await getTranslations({ locale, namespace: 'Projects' });
return {
title: `${t('project_list')} | UnitTCMS`,
robots: { index: false, follow: false },
};
}
export default function ProjectsLayout({ children }: { children: React.ReactNode }) { export default function ProjectsLayout({ children }: { children: React.ReactNode }) {
return <>{children}</>; return <>{children}</>;
} }

View File

@@ -7,7 +7,7 @@ import { ProjectDialogMessages, ProjectsMessages } from '@/types/project';
export default function Page({ params }: PageType) { export default function Page({ params }: PageType) {
const t = useTranslations('Projects'); const t = useTranslations('Projects');
const messages: ProjectsMessages = { const messages: ProjectsMessages = {
projectList: t('projectList'), projectList: t('project_list'),
newProject: t('new_project'), newProject: t('new_project'),
id: t('id'), id: t('id'),
publicity: t('publicity'), publicity: t('publicity'),