Skip to content

Commit

Permalink
feat: add description to html metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Nov 5, 2022
1 parent 5b7fa21 commit 8b8a04f
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 19 deletions.
1 change: 1 addition & 0 deletions environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ declare namespace NodeJS {
interface ProcessEnv {
APP_TITLE: string
APP_KEYWORDS: string
APP_DESCRIPTION: string
OKP4_DISCORD_URL: string
OKP4_GITHUB_URL: string
OKP4_LINKEDIN_URL: string
Expand Down
4 changes: 3 additions & 1 deletion src/components/head/Head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import { getLastSegmentInPath } from '../../lib/path'
export type HeadProps = {
title: string
keywords: string
description: string
}

// eslint-disable-next-line @typescript-eslint/typedef
const { publicRuntimeConfig } = getConfig()

export const Head: React.FC<HeadProps> = ({ title, keywords }): JSX.Element => {
export const Head: React.FC<HeadProps> = ({ description, title, keywords }): JSX.Element => {
const router = useRouter()
const segment = getLastSegmentInPath(router.pathname)
const pageTitle = `${title}${segment ? ` | ${segment.toUpperCase()}` : ''}`
Expand All @@ -22,6 +23,7 @@ export const Head: React.FC<HeadProps> = ({ title, keywords }): JSX.Element => {
<title>{pageTitle}</title>
<meta content={keywords} name="keywords" />
<meta content={publicRuntimeConfig.version} name="version" />
<meta content={description} name="description" />
<link href="/okp4-logo.webp" rel="icon" />
</HtmlHead>
)
Expand Down
1 change: 1 addition & 0 deletions src/pages/api/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default function handler(_req: NextApiRequest, res: NextApiResponse<Confi
const config: Config = {
title: process.env.APP_TITLE,
keywords: process.env.APP_KEYWORDS,
description: process.env.APP_DESCRIPTION,
urls: {
websiteUrl: process.env.OKP4_WEBSITE_URL,
socialMediaUrls: {
Expand Down
7 changes: 4 additions & 3 deletions src/pages/faq.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type FAQUrls = {
typeformUrl: string
}

export type FAQProps = Pick<Config, 'title' | 'keywords' | 'urls'>
export type FAQProps = Pick<Config, 'title' | 'keywords' | 'description' | 'urls'>

const faqs = (urls: FAQUrls): FAQ[] => [
{
Expand Down Expand Up @@ -225,7 +225,8 @@ const faqs = (urls: FAQUrls): FAQ[] => [
}
]

const Faq: NextPage<FAQProps> = ({ keywords, title, urls }) => {
const Faq: NextPage<FAQProps> = props => {
const { urls } = props
const [activeIndex, setActiveIndex] = useState<number | null>(null)
const { socialMediaUrls, docsUrls, typeformUrl } = urls
const { discordUrl } = socialMediaUrls
Expand All @@ -236,7 +237,7 @@ const Faq: NextPage<FAQProps> = ({ keywords, title, urls }) => {
}
return (
<div className="okp4-nemeton-web-page-main">
<Head keywords={keywords} title={title} />
<Head {...props} />
<main>
<Header typeformUrl={typeformUrl} />
<div className="okp4-nemeton-web-page-content-container" id="faq">
Expand Down
7 changes: 4 additions & 3 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import { Imbolc } from '../components/imbolc/Imbolc'
import { Beltaine } from '../components/beltaine/Beltaine'
import type { Config } from '../types/config.type'

export type HomeProps = Pick<Config, 'title' | 'keywords' | 'urls'>
export type HomeProps = Pick<Config, 'title' | 'keywords' | 'description' | 'urls'>

const Home: NextPage<HomeProps> = ({ keywords, title, urls }) => {
const Home: NextPage<HomeProps> = (props) => {
const { urls } = props
return (
<div>
<Head keywords={keywords} title={title} />
<Head {...props} />
<main>
<Header typeformUrl={urls.typeformUrl} />
<div className="okp4-nemeton-web-phases-main" id="home">
Expand Down
7 changes: 4 additions & 3 deletions src/pages/privacy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { Footer } from '../components/layout/footer/Footer'
import { Header } from '../components/layout/header/Header'
import type { Config } from '../types/config.type'

export type PrivacyProps = Pick<Config, 'title' | 'keywords' | 'urls'>
export type PrivacyProps = Pick<Config, 'title' | 'keywords' | 'description' | 'urls'>

const Privacy: NextPage<PrivacyProps> = ({ keywords, title, urls }) => {
const Privacy: NextPage<PrivacyProps> = props => {
const { urls } = props
const {
typeformUrl,
privacyUrls: { cookiePolicyUrl },
Expand All @@ -16,7 +17,7 @@ const Privacy: NextPage<PrivacyProps> = ({ keywords, title, urls }) => {

return (
<div className="okp4-nemeton-web-page-main">
<Head keywords={keywords} title={title} />
<Head {...props} />
<main>
<Header typeformUrl={typeformUrl} />
<div className="okp4-nemeton-web-page-content-container" id="privacy-cookie-policy">
Expand Down
7 changes: 4 additions & 3 deletions src/pages/rewards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import { Footer } from '../components/layout/footer/Footer'
import { Header } from '../components/layout/header/Header'
import type { Config } from '../types/config.type'

export type RewardsProps = Pick<Config, 'title' | 'keywords' | 'urls'>
export type RewardsProps = Pick<Config, 'title' | 'keywords' | 'description' | 'urls'>

const Rewards: NextPage<RewardsProps> = ({ keywords, title, urls }) => {
const Rewards: NextPage<RewardsProps> = props => {
const { urls } = props
const { typeformUrl } = urls

return (
<div className="okp4-nemeton-web-page-main">
<Head keywords={keywords} title={title} />
<Head {...props} />
<main>
<Header typeformUrl={typeformUrl} />
<div className="okp4-nemeton-web-page-content-container" id="rewards">
Expand Down
7 changes: 4 additions & 3 deletions src/pages/support.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { Header } from '../components/layout/header/Header'
import type { Config } from '../types/config.type'
import { supportRoutes } from '../routes'

export type SupportProps = Pick<Config, 'title' | 'keywords' | 'urls'>
export type SupportProps = Pick<Config, 'title' | 'keywords' | 'description' | 'urls'>

const Support: NextPage<SupportProps> = ({ keywords, title, urls }) => {
const Support: NextPage<SupportProps> = (props) => {
const { urls } = props
const {
typeformUrl,
supportUrls: { discordNemetonUrl, discordTicketUrl },
Expand All @@ -19,7 +20,7 @@ const Support: NextPage<SupportProps> = ({ keywords, title, urls }) => {

return (
<div className="okp4-nemeton-web-page-main">
<Head keywords={keywords} title={title} />
<Head {...props} />
<main>
<Header typeformUrl={typeformUrl} />
<div className="okp4-nemeton-web-page-content-container" id="support-page">
Expand Down
7 changes: 4 additions & 3 deletions src/pages/terms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { Header } from '../components/layout/header/Header'
import type { Config } from '../types/config.type'
import { termsRoutes } from '../routes'

export type TermsProps = Pick<Config, 'title' | 'keywords' | 'urls'>
export type TermsProps = Pick<Config, 'title' | 'keywords' | 'description' | 'urls'>

const Terms: NextPage<TermsProps> = ({ keywords, title, urls }) => {
const Terms: NextPage<TermsProps> = props => {
const { urls } = props
const {
typeformUrl,
socialMediaUrls: { discordUrl },
Expand All @@ -21,7 +22,7 @@ const Terms: NextPage<TermsProps> = ({ keywords, title, urls }) => {

return (
<div className="okp4-nemeton-web-page-main">
<Head keywords={keywords} title={title} />
<Head {...props} />
<main>
<Header typeformUrl={typeformUrl} />
<div className="okp4-nemeton-web-page-content-container" id="terms-conditions">
Expand Down
1 change: 1 addition & 0 deletions src/types/config.type.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export type Config = {
title: string
keywords: string
description: string
urls: {
websiteUrl: string
socialMediaUrls: {
Expand Down

0 comments on commit 8b8a04f

Please sign in to comment.