Skip to content

Commit

Permalink
Improve head meta
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhaofe committed Sep 26, 2021
1 parent 13bf0ab commit 340053c
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 22 deletions.
15 changes: 15 additions & 0 deletions components/layout.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import Head from 'next/head'
import Header from './header'
import Footer from './footer'
import styles from '../styles/Layout.module.css'

export default function Layout({ children }) {
// https://nextjs.org/docs/api-reference/next/head
return (
<>
<Head >
<title>fHz | fly through the waves</title>
<meta name="description" content="fly through the waves" />
<meta property="og:title" content="fHz" key="title" />
<meta property="og:description" content="fly through the waves" key="description" />
<meta property="og:type" content="website" key="type" />
<meta property="og:url" content="https://flyhaozi.com/" key="url" />
<meta property="og:image" content="https://flyhaozi.com/banner.jpg" key="image" />
<meta name="twitter:card" content="summary_large_image" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
</Head>
<Header />
<main className={styles.children}>{children}</main>
<Footer />
Expand Down
14 changes: 4 additions & 10 deletions pages/[project].js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ export default function Project({ source, frontMatter }) {
return (
<>
<Head >
<title>{frontMatter.title}</title>
<title>{frontMatter.title + " | fHz"}</title>
<meta name="description" content={frontMatter.description} />
<meta property="og:title" content={frontMatter.title} />
<meta property="og:description" content={frontMatter.description} />
<meta property="og:type" content="website" />
<meta property="og:url" content={"https://flyhaozi.com/" + frontMatter.path} />
<meta property="og:image" content="https://flyhaozi.com/banner.jpg" />
<meta name="twitter:card" content="summary_large_image" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<meta property="og:title" content={frontMatter.title + " | fHz"} key="title" />
<meta property="og:description" content={frontMatter.description} key="description" />
<meta property="og:url" content={"https://flyhaozi.com/" + frontMatter.path} key="url" />
</Head>
<div className={cstyles.top}>
<h1>{frontMatter.title}</h1>
Expand Down
6 changes: 6 additions & 0 deletions pages/about.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import Head from 'next/head'
import cstyles from '../styles/Common.module.css'

export default function About() {
return (
<>
<Head >
<title>About | fHz</title>
<meta property="og:title" content="About | fHz" key="title" />
<meta property="og:url" content="https://flyhaozi.com/about" key="url" />
</Head>
<article className={cstyles.section}>
<h2>About Me</h2>
<p>Hi, I am <em>Yuhao Feng</em>. fHz is the name I use to publish my works.</p>
Expand Down
9 changes: 8 additions & 1 deletion pages/blog.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import Head from 'next/head'
import Link from 'next/link'
import cstyles from '../styles/Common.module.css'

export default function Blog() {
return (
<section className={cstyles.section}>
<Head >
<title>Blog | fHz</title>
<meta property="og:title" content="Blog | fHz" key="title" />
<meta property="og:url" content="https://flyhaozi.com/blog" key="url" />
</Head>
<h2>Blog (Under Construction)</h2>
<ul className={cstyles.blogList}>
<li><span>2021-10-01</span><a href="/blog/2021-national-day">Celebrate The 2021 National Day!!! 🎉✨</a></li>
<li><span>2021-10-01</span><Link href="/blog/2021-national-day"><a >Celebrate The 2021 National Day!!! 🎉✨</a></Link></li>
</ul>
</section>
)
Expand Down
15 changes: 4 additions & 11 deletions pages/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pages/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ import { promises as fs } from 'fs'
import matter from 'gray-matter'
import path from 'path'
import Link from 'next/link'
import Head from 'next/head'
import cstyles from '../styles/Common.module.css'

export default function Projects({ projectInfos }) {
return (
<section className={cstyles.section}>
<Head >
<title>Projects | fHz</title>
<meta property="og:title" content="Projects | fHz" key="title" />
<meta property="og:url" content="https://flyhaozi.com/projects" key="url" />
</Head>
<h2>Projects</h2>
<div className={cstyles.cardContainer}>
{
Expand Down

0 comments on commit 340053c

Please sign in to comment.