-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Homepage SEO optimizations and schema.org markup #16855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5248dea
d45bb4f
fb9256c
10f0a0e
f3e5ff5
c15cfb4
1e1cfd8
650d050
d2c5866
48ce4bf
51aba45
06082b2
ab39058
30db5de
94f5455
c5ba278
c0fef09
2fdf583
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,14 +76,20 @@ const BigNumber = async ({ | |
| <div | ||
| data-label="big-number" | ||
| className={cn(bigNumberVariants({ variant }), className)} | ||
| itemScope | ||
| itemType="https://schema.org/Observation" | ||
| > | ||
| {value ? ( | ||
| <> | ||
| <div data-label="value" className={valueVariants({ variant })}> | ||
| <div | ||
| data-label="value" | ||
| className={valueVariants({ variant })} | ||
| itemProp="value" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for these meta tags. Can we handle all related jsonld things in the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The microdata (itemScope/itemProp) and JSON-LD in page-jsonld files are actually two different approaches to structured data:
For dynamic values like the stats in That said, the hardcoded strings ("Ethereum Network Statistics") in a reusable component is awkward - if these components get used elsewhere with different data, those names would be wrong. Happy to make the schema name/description props instead of hardcoded, or remove the microdata entirely if you'd prefer to keep these components generic?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good. Yeah, now that I see, the The main problem is with the // page level
<div itemScope itemType="https://schema.org/Dataset">
<meta itemProp="name" content="Ethereum Network Statistics" />
<meta itemProp="description" content="Ethereum Network Statistics" />
<ActivityStats metrics={metrics} />
</div> |
||
| > | ||
| {value} | ||
| </div> | ||
| <div className={childrenVariants({ variant })}> | ||
| {children} | ||
| <span itemProp="name">{children}</span> | ||
| {sourceName && sourceUrl && ( | ||
| <> | ||
| | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this one-off component abstracted? It's all server-side, would suggest we apply this straight to the app/[locale]/page.tsx
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i defer to @pettinarip on repo code standards. personally i like abstract everything but i don't know ball anymore |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { Info } from "lucide-react" | ||
| import { getLocale, getTranslations } from "next-intl/server" | ||
|
|
||
| import type { MetricReturnData } from "@/lib/types" | ||
|
|
||
| import Tooltip from "@/components/Tooltip" | ||
| import InlineLink from "@/components/ui/Link" | ||
|
|
||
| import { cn } from "@/lib/utils/cn" | ||
| import { formatPriceUSD } from "@/lib/utils/numbers" | ||
|
|
||
| interface EthPriceSimpleProps extends React.HTMLAttributes<HTMLDivElement> { | ||
| ethPrice: MetricReturnData | ||
| } | ||
|
|
||
| const EthPriceSimple = async ({ | ||
| ethPrice, | ||
| className, | ||
| ...props | ||
| }: EthPriceSimpleProps) => { | ||
| const locale = await getLocale() | ||
| const t = await getTranslations({ locale, namespace: "common" }) | ||
|
|
||
| const hasError = "error" in ethPrice | ||
|
|
||
| const price = hasError | ||
| ? t("loading-error-refresh") | ||
| : formatPriceUSD(ethPrice.value, locale) | ||
|
|
||
| const tooltipContent = ( | ||
| <div> | ||
| {t("data-provided-by")}{" "} | ||
| <InlineLink href="https://www.coingecko.com/en/coins/ethereum"> | ||
| coingecko.com | ||
| </InlineLink> | ||
| </div> | ||
| ) | ||
|
|
||
| return ( | ||
| <div className={cn("py-4", className)} {...props}> | ||
| <div | ||
| className={cn("text-5xl font-bold", hasError && "text-md text-error")} | ||
| > | ||
| {price} | ||
| </div> | ||
| <div className="mt-1 flex items-center gap-1 text-sm text-body-medium"> | ||
| {t("eth-current-price")} | ||
| <Tooltip content={tooltipContent}> | ||
| <Info className="size-4" /> | ||
| </Tooltip> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| export default EthPriceSimple |
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fine with this. Think there are other, optimized ways, in case we want to keep the icons in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First time seeing these meta item/tags. I assume they are related with the jsonlds. Question: can we declare this in the corresponding
page-jsonldfiles for the home page? these are hardcoded values for a reusable UI component.