Skip to content

Commit 6b672b5

Browse files
committed
Merge branch 'dev' into contributorsJsonBug
2 parents 4fe03e1 + 931b249 commit 6b672b5

File tree

5 files changed

+72
-201
lines changed

5 files changed

+72
-201
lines changed

src/components/PageMetadata.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ import Head from "next/head"
44
import { useRouter } from "next/router"
55
import { useTranslation } from "next-i18next"
66

7-
import { DEFAULT_LOCALE, SITE_URL } from "@/lib/constants"
8-
9-
import ogImageDapps from "@/public/doge-computer.png"
10-
import ogImageDevelopers from "@/public/enterprise-eth.png"
11-
import ogImageDefault from "@/public/home/hero.png"
12-
import ogImageUpgrades from "@/public/upgrades/upgrade_doge.png"
7+
import { SITE_URL } from "@/lib/constants"
138

149
type NameMeta = {
1510
name: string
@@ -44,33 +39,38 @@ const PageMetadata: React.FC<IProps> = ({
4439
const desc = description || t("site-description")
4540
const siteTitle = t("site-title")
4641
const fullTitle = `${title} | ${siteTitle}`
42+
const origin = process.env.NEXT_PUBLIC_SITE_URL || SITE_URL // TODO: Remove .env var usage after launch
43+
44+
// Remove any query params (?) or hash links (#)
45+
const path = asPath.replace(/[\?\#].*/, "")
46+
const slug = path.split("/")
4747

4848
/* Set canonical URL w/ language path to avoid duplicate content */
4949
/* e.g. set ethereum.org/about/ to ethereum.org/en/about/ */
50-
const canonical = canonicalUrl || join(SITE_URL, DEFAULT_LOCALE, asPath)
51-
const url = locale ? join(SITE_URL, locale, asPath) : canonical
50+
const url = new URL(join(locale!, path), origin).href
51+
const canonical = canonicalUrl || url
5252

5353
/* Set fallback ogImage based on path */
54-
let ogImage = ogImageDefault.src
54+
let ogImage = "/home/hero.png"
5555

56-
if (asPath.includes("/developers/")) {
57-
ogImage = ogImageDevelopers.src
56+
if (slug.includes("developers")) {
57+
ogImage = "/enterprise-eth.png"
5858
}
5959

60-
if (asPath.includes("/dapps/")) {
61-
ogImage = ogImageDapps.src
60+
if (slug.includes("dapps")) {
61+
ogImage = "/doge-computer.png"
6262
}
6363

64-
if (asPath.includes("/roadmap/")) {
65-
ogImage = ogImageUpgrades.src
64+
if (slug.includes("roadmap")) {
65+
ogImage = "/upgrades/upgrade_doge.png"
6666
}
6767

6868
if (image) {
6969
ogImage = image
7070
}
7171

72-
const ogImageUrl = join(SITE_URL, ogImage)
73-
const metadata: Array<Meta> = [
72+
const ogImageUrl = new URL(ogImage, origin).href
73+
const metadata: Meta[] = [
7474
{ name: `description`, content: desc },
7575
{ name: `image`, content: ogImageUrl },
7676
{ property: `og:title`, content: fullTitle },

src/components/ReleaseBanner.tsx

Lines changed: 0 additions & 142 deletions
This file was deleted.

src/layouts/Roadmap.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ const HeroContainer = (props: ChildOnlyProp) => (
4848
mb={{ base: 8, lg: 0 }}
4949
maxH={{ base: "100%", lg: "none" }}
5050
{...props}
51+
justify="space-between"
5152
/>
5253
)
5354

5455
const TitleCard = (props: ChildOnlyProp) => (
55-
<Flex p={8} direction="column" justify="flex-start" {...props} />
56+
<Flex w="full" p={8} direction="column" justify="flex-start" {...props} />
5657
)
5758

5859
// Roadmap layout components
@@ -140,11 +141,6 @@ export const RoadmapLayout: React.FC<IProps> = ({
140141
/>
141142
) : (
142143
<HeroContainer>
143-
<Flex
144-
w="full"
145-
flexDirection={{ base: "column", lg: "row" }}
146-
justify="space-between"
147-
>
148144
<TitleCard>
149145
{/* TODO: Double check this slug works */}
150146
<Breadcrumbs slug={slug} mb="8" />
@@ -186,12 +182,11 @@ export const RoadmapLayout: React.FC<IProps> = ({
186182
src={frontmatter.image}
187183
alt={frontmatter.alt ?? ""}
188184
style={{ objectFit: "contain" }}
189-
width={700}
185+
width={1504}
190186
height={345}
191187
priority
192188
/>
193189
</Center>
194-
</Flex>
195190
</HeroContainer>
196191
)}
197192
<Page>

src/layouts/Static.tsx

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Contributors from "@/components/Contributors"
1010
import EnergyConsumptionChart from "@/components/EnergyConsumptionChart"
1111
import FeedbackCard from "@/components/FeedbackCard"
1212
import GlossaryDefinition from "@/components/Glossary/GlossaryDefinition"
13+
import { HubHero } from "@/components/Hero"
1314
import NetworkUpgradeSummary from "@/components/History/NetworkUpgradeSummary"
1415
import Link from "@/components/Link"
1516
import Logo from "@/components/Logo"
@@ -29,9 +30,12 @@ import TranslationChartImage from "@/components/TranslationChartImage"
2930
import UpcomingEventsList from "@/components/UpcomingEventsList"
3031

3132
import { getLocaleTimestamp } from "@/lib/utils/time"
33+
import { isLangRightToLeft } from "@/lib/utils/translations"
3234

3335
import { CONTENT_DIR } from "@/lib/constants"
3436

37+
import GuideHeroImage from "@/public/heroes/guides-hub-hero.jpg"
38+
3539
const Heading1 = (props: HeadingProps) => (
3640
<MdHeading1 fontSize={{ base: "2.5rem", md: "5xl" }} {...props} />
3741
)
@@ -101,43 +105,58 @@ export const StaticLayout: React.FC<IProps> = ({
101105
p={8}
102106
pt={{ base: 8, lg: 16 }}
103107
>
104-
<Box
105-
as="article"
106-
maxW="container.md"
107-
w="full"
108-
sx={{
109-
".featured": {
110-
ps: 4,
111-
ms: -4,
112-
borderInlineStart: "1px dotted",
113-
borderInlineStartColor: "primary.base",
114-
},
108+
<Box>
109+
{slug === "/guides/" ? (
110+
<HubHero
111+
heroImg={GuideHeroImage}
112+
header={frontmatter.title}
113+
title={""}
114+
description={frontmatter.description}
115+
/>
116+
) : (
117+
<>
118+
<Breadcrumbs slug={slug} mb="8" />
119+
<Text
120+
color="text200"
121+
dir={isLangRightToLeft(locale as Lang) ? "rtl" : "ltr"}
122+
>
123+
<Translation id="page-last-updated" />:{" "}
124+
{getLocaleTimestamp(locale as Lang, lastUpdatedDate!)}
125+
</Text>
126+
</>
127+
)}
128+
129+
<Box
130+
as="article"
131+
maxW="container.md"
132+
w="full"
133+
sx={{
134+
".featured": {
135+
ps: 4,
136+
ms: -4,
137+
borderInlineStart: "1px dotted",
138+
borderInlineStartColor: "primary.base",
139+
},
115140

116-
".citation": {
117-
p: {
118-
color: "text200",
141+
".citation": {
142+
p: {
143+
color: "text200",
144+
},
119145
},
120-
},
121-
}}
122-
>
123-
<Breadcrumbs slug={slug} mb="8" />
124-
<Text
125-
color="text200"
146+
}}
126147
>
127-
<Translation id="page-last-updated" />:{" "}
128-
{getLocaleTimestamp(locale as Lang, lastUpdatedDate!)}
129-
</Text>
130-
<TableOfContents
131-
position="relative"
132-
zIndex={2}
133-
items={tocItems}
134-
isMobile
135-
maxDepth={frontmatter.sidebarDepth || 2}
136-
hideEditButton={!!frontmatter.hideEditButton}
137-
/>
138-
{children}
148+
<TableOfContents
149+
position="relative"
150+
zIndex={2}
151+
items={tocItems}
152+
isMobile
153+
maxDepth={frontmatter.sidebarDepth || 2}
154+
hideEditButton={!!frontmatter.hideEditButton}
155+
/>
156+
{children}
139157

140-
<FeedbackCard isArticle />
158+
<FeedbackCard isArticle />
159+
</Box>
141160
</Box>
142161
<TableOfContents
143162
editPath={absoluteEditPath}

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
"./src/components/Morpher.tsx",
7979
"./src/components/OrderedList.tsx",
8080
"./src/components/ProductList.tsx",
81-
"./src/components/ReleaseBanner.tsx",
8281
"./src/components/RollupProductDevDoc.tsx",
8382
"./src/components/Search/SearchButton.tsx",
8483
"./src/components/Search/SearchModal.tsx",

0 commit comments

Comments
 (0)