mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-07 23:43:57 +02:00
feat(resources): improve SEO
This commit is contained in:
@@ -8,6 +8,7 @@ interface ISEOProps {
|
|||||||
readonly meta?: any[]
|
readonly meta?: any[]
|
||||||
readonly keywords?: string[]
|
readonly keywords?: string[]
|
||||||
readonly title: string
|
readonly title: string
|
||||||
|
readonly subCategory?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SEO: FC<ISEOProps> = ({
|
export const SEO: FC<ISEOProps> = ({
|
||||||
@@ -16,6 +17,7 @@ export const SEO: FC<ISEOProps> = ({
|
|||||||
meta = [],
|
meta = [],
|
||||||
keywords = [],
|
keywords = [],
|
||||||
title,
|
title,
|
||||||
|
subCategory,
|
||||||
}) => {
|
}) => {
|
||||||
const { site } = useStaticQuery(
|
const { site } = useStaticQuery(
|
||||||
graphql`
|
graphql`
|
||||||
@@ -38,7 +40,7 @@ export const SEO: FC<ISEOProps> = ({
|
|||||||
htmlAttributes={{
|
htmlAttributes={{
|
||||||
lang,
|
lang,
|
||||||
}}
|
}}
|
||||||
title={title}
|
title={subCategory ? `${title} - ${subCategory}` : title}
|
||||||
titleTemplate={`%s | ${site.siteMetadata.title}`}
|
titleTemplate={`%s | ${site.siteMetadata.title}`}
|
||||||
meta={[
|
meta={[
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ import { ResourcesList } from "../components/ResourcesList"
|
|||||||
import { SEO } from "../components/SEO"
|
import { SEO } from "../components/SEO"
|
||||||
import { PageContent } from "../components/PageContent"
|
import { PageContent } from "../components/PageContent"
|
||||||
import { Footer } from "../components/Footer"
|
import { Footer } from "../components/Footer"
|
||||||
|
import useSidebar from "../hooks/useSidebar"
|
||||||
|
|
||||||
// @todo maybe find alternative type for data
|
// @todo maybe find alternative type for data
|
||||||
const LanguageHome: FC<any> = ({ data, pageContext }) => {
|
const LanguageHome: FC<any> = ({ data, pageContext }) => {
|
||||||
|
const { current: language } = useSidebar()
|
||||||
const { relativePath } = data.file
|
const { relativePath } = data.file
|
||||||
const { html, excerpt, fields, frontmatter, timeToRead } = data.file.post
|
const { html, excerpt, fields, frontmatter, timeToRead } = data.file.post
|
||||||
|
|
||||||
@@ -18,7 +20,11 @@ const LanguageHome: FC<any> = ({ data, pageContext }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<SEO title={frontmatter.title} description={excerpt} />
|
<SEO
|
||||||
|
title={frontmatter.title}
|
||||||
|
subCategory={language}
|
||||||
|
description={excerpt}
|
||||||
|
/>
|
||||||
<Header
|
<Header
|
||||||
relativePath={relativePath}
|
relativePath={relativePath}
|
||||||
basePath="/resources"
|
basePath="/resources"
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ import { Header } from "../components/Header"
|
|||||||
import { Markdown } from "../components/Markdown"
|
import { Markdown } from "../components/Markdown"
|
||||||
import { PageContent } from "../components/PageContent"
|
import { PageContent } from "../components/PageContent"
|
||||||
import { SEO } from "../components/SEO"
|
import { SEO } from "../components/SEO"
|
||||||
|
import useSidebar from "../hooks/useSidebar"
|
||||||
import { buildToc } from "../utils"
|
import { buildToc } from "../utils"
|
||||||
|
|
||||||
// @todo maybe find alternative type for data
|
// @todo maybe find alternative type for data
|
||||||
const LanguagePost: FC<any> = ({ data }) => {
|
const LanguagePost: FC<any> = ({ data }) => {
|
||||||
|
const { current: language } = useSidebar()
|
||||||
const { relativePath } = data.file
|
const { relativePath } = data.file
|
||||||
const {
|
const {
|
||||||
html,
|
html,
|
||||||
@@ -31,7 +33,11 @@ const LanguagePost: FC<any> = ({ data }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<SEO title={frontmatter.title} description={excerpt} />
|
<SEO
|
||||||
|
title={frontmatter.title}
|
||||||
|
subCategory={language}
|
||||||
|
description={excerpt}
|
||||||
|
/>
|
||||||
<Header
|
<Header
|
||||||
relativePath={relativePath}
|
relativePath={relativePath}
|
||||||
basePath="/resources"
|
basePath="/resources"
|
||||||
|
|||||||
Reference in New Issue
Block a user