-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db1d9cf
commit 533e9c4
Showing
7 changed files
with
126 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { FC } from 'react'; | ||
|
||
const StructuredData: FC<{ ld: any }> = ({ ld }) => { | ||
return ( | ||
<script | ||
dangerouslySetInnerHTML={{ __html: JSON.stringify(ld) }} | ||
id="structured-data" | ||
type="application/ld+json" | ||
/> | ||
); | ||
}; | ||
export default StructuredData; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { Helmet } from 'dumi'; | ||
import isEqual from 'fast-deep-equal'; | ||
import { FC } from 'react'; | ||
import urlJoin from 'url-join'; | ||
|
||
import { siteSelectors, useSiteStore } from '@/store'; | ||
|
||
const date = new Date().toISOString(); | ||
|
||
const StructuredData: FC = () => { | ||
const [title, desc, logo, hostname] = useSiteStore((s) => [ | ||
siteSelectors.siteTitle(s), | ||
siteSelectors.siteDesc(s), | ||
siteSelectors.logo(s), | ||
siteSelectors.hostname(s), | ||
]); | ||
const metadata = useSiteStore(siteSelectors.metadata, isEqual); | ||
const host = hostname || location.origin; | ||
|
||
const ld = { | ||
'@context': 'https://schema.org', | ||
'@graph': [ | ||
{ | ||
'@id': urlJoin(host, '#website'), | ||
'@type': 'WebSite', | ||
'description': desc, | ||
'inLanguage': 'en-US', | ||
'name': 'LobeHub', | ||
'publisher': { '@id': urlJoin(host, '#organization') }, | ||
'url': host, | ||
}, | ||
{ | ||
'@id': host, | ||
'@type': 'WebPage', | ||
'about': { '@id': urlJoin(host, '#organization') }, | ||
'dateModified': date, | ||
'datePublished': date, | ||
'description': desc, | ||
'image': { '@id': urlJoin(host, '#primaryimage') }, | ||
'inLanguage': 'en-US', | ||
'isPartOf': { '@id': urlJoin(host, '#website') }, | ||
'name': title, | ||
'primaryImageOfPage': { '@id': urlJoin(host, '#primaryimage') }, | ||
'thumbnailUrl': metadata?.twitter?.image || metadata?.openGraph?.image, | ||
}, | ||
{ | ||
'@id': urlJoin(host, '#primaryimage'), | ||
'@type': 'ImageObject', | ||
'contentUrl': metadata?.twitter?.image || metadata?.openGraph?.image || logo, | ||
'inLanguage': 'en-US', | ||
'url': metadata?.twitter?.image || metadata?.openGraph?.image || logo, | ||
}, | ||
{ | ||
'@id': urlJoin(host, '#organization'), | ||
'@type': 'Organization', | ||
'alternateName': 'LobeHub', | ||
'contactPoint': { | ||
'@type': 'ContactPoint', | ||
'contactType': 'customer support', | ||
'email': '[email protected]', | ||
}, | ||
'description': | ||
'We are a group of e/acc design-engineers, hoping to provide modern design components and tools for AIGC, and creating a technology-driven forum, fostering knowledge interaction and the exchange of ideas that may culminate in mutual inspiration and collaborative innovation.', | ||
'email': '[email protected]', | ||
'founders': [ | ||
{ '@type': 'Person', 'name': 'Arvin Xu', 'url': 'https://github.com/arvinxx' }, | ||
{ '@type': 'Person', 'name': 'CanisMinor', 'url': 'https://github.com/arvinxx' }, | ||
], | ||
'image': 'https://lobehub.com/icon-512x512.png', | ||
'logo': { | ||
'@type': 'ImageObject', | ||
'height': 512, | ||
'url': 'https://lobehub.com/icon-512x512.png', | ||
'width': 512, | ||
}, | ||
'name': 'LobeHub', | ||
'sameAs': [ | ||
'https://x.com/lobehub', | ||
'https://github.com/lobehub', | ||
'https://medium.com/@lobehub', | ||
'https://www.youtube.com/@lobehub', | ||
], | ||
'url': 'https://lobehub.com', | ||
}, | ||
], | ||
}; | ||
|
||
return ( | ||
<Helmet> | ||
<script | ||
dangerouslySetInnerHTML={{ __html: JSON.stringify(ld) }} | ||
id="structured-data" | ||
type="application/ld+json" | ||
/> | ||
</Helmet> | ||
); | ||
}; | ||
export default StructuredData; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters