Skip to content

Commit

Permalink
update astro to v2 and use content collections for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zzq0826 committed May 23, 2023
1 parent b5e4589 commit 0863c4f
Show file tree
Hide file tree
Showing 62 changed files with 245 additions and 72 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
plugins: ["@typescript-eslint", "prettier"],
rules: {
"no-unused-expressions": "off",
"@typescript-eslint/triple-slash-reference": "off",
"prettier/prettier": [2],
},
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ typechain-types/
.temp*

.cache
.vscode
.vscode

.astro/
1 change: 1 addition & 0 deletions astro-i18next.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type {import('astro-i18next').AstroI18nextConfig} */
export default {
defaultLocale: "en",
showDefaultLocale: true,
locales: ["en", "zh"],
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@types/github-slugger": "^1.3.0",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"astro": "^1.6.8",
"astro": "^2.4.4",
"dart-linkcheck": "^2.0.15",
"dotenv": "^16.0.3",
"eslint": "^8.27.0",
Expand Down
3 changes: 3 additions & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,8 @@
"infrastructure": {
"introduction": "Introduction"
}
},
"notTranslated": {
"notTranslated": "This page has not been translated yet."
}
}
3 changes: 3 additions & 0 deletions public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,8 @@
"infrastructure": {
"introduction": "介绍"
}
},
"notTranslated": {
"notTranslated": "此页面尚未翻译。"
}
}
10 changes: 6 additions & 4 deletions src/components/LeftSidebar/LeftSidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ const currentPageMatch = removeSlashes(currentPage.slice(1))
<>
<li class="nav-link">
<a
href={isExternal(child.url) ? `${child.url}` : localizePath(child.url)}
href={isExternal(child.url) ? `${child.url}` : localizePath("/docs/" + child.url)}
target={isExternal(child.url) ? "_blank" : "_self"}
aria-current={`${currentPage === localizePath(child.url) ? "page" : "false"}`}
aria-current={`${currentPage === localizePath("/docs/" + child.url) ? "page" : "false"}`}
>
{child.title}
{isExternal(child.url) && (
Expand All @@ -77,9 +77,11 @@ const currentPageMatch = removeSlashes(currentPage.slice(1))
{child.children.map((childItem) => (
<li class="nav-link nested">
<a
href={isExternal(childItem.url) ? childItem.url : localizePath(childItem.url)}
href={isExternal(childItem.url) ? childItem.url : localizePath("/docs/" + childItem.url)}
target={isExternal(child.url) ? "_blank" : "_self"}
aria-current={`${currentPage === localizePath(childItem.url) ? "page" : "false"}`}
aria-current={`${
currentPage === localizePath("/docs/" + childItem.url) ? "page" : "false"
}`}
>
{childItem.title}
{isExternal(childItem.url) && (
Expand Down
16 changes: 8 additions & 8 deletions src/config/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ export const MENU: MenuItems = {
en: [
{
text: "Getting Started",
link: "/getting-started/overview",
link: "/en/docs/getting-started/overview",
section: "gettingStarted",
},
{ text: "Developers", link: "/developers", section: "developers" },
{ text: "Technology", link: "/technology", section: "technology" },
{ text: "Learn", link: "/learn", section: "learn" },
{ text: "Developers", link: "/en/docs/developers", section: "developers" },
{ text: "Technology", link: "/en/docs/technology", section: "technology" },
{ text: "Learn", link: "/en/docs/learn", section: "learn" },
],
zh: [
{
text: "入门",
link: "/zh/getting-started/overview",
link: "/zh/docs/getting-started/overview",
section: "gettingStarted",
},
{ text: "开发者", link: "/zh/developers", section: "developers" },
{ text: "技术", link: "/zh/technology", section: "technology" },
{ text: "学习", link: "/zh/learn", section: "learn" },
{ text: "开发者", link: "/zh/docs/developers", section: "developers" },
{ text: "技术", link: "/zh/docs/technology", section: "technology" },
{ text: "学习", link: "/zh/docs/learn", section: "learn" },
],
}
12 changes: 12 additions & 0 deletions src/content/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineCollection, z } from "astro:content"

const docsCollection = defineCollection({
schema: z.object({
title: z.string(),
section: z.string(),
}),
})

export const collections = {
docs: docsCollection,
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: developers
date: Last Modified
title: "Alpha Testnet Contracts"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: developers
date: Last Modified
title: "Developer Quickstart"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: developers
date: Last Modified
title: "Ethereum & Alpha Testnet Differences"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: developers
date: Last Modified
title: "Contract Deployment Tutorial"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: developers
date: Last Modified
title: "Building on Scroll"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: developers
date: Last Modified
title: ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "Scroll Overview"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
---
layout: ../../layouts/MainLayout.astro
section: learn
title: "Learn Landing Title"
lang: "en"
isMdx: true
---

import ClickToZoom from "../../components/ClickToZoom.astro"
import priceAggr from "../../assets/images/contract-devs/price-aggr.png"
import ToggleElement from "../../components/ToggleElement.astro"
import Aside from "../../components/Aside.astro"
import ClickToZoom from "../../../../components/ClickToZoom.astro"
import priceAggr from "../../../../assets/images/contract-devs/price-aggr.png"
import ToggleElement from "../../../../components/ToggleElement.astro"
import Aside from "../../../../components/Aside.astro"

Content for the Research landing page. for fancy stuff, see the infrastructure page.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: technology
title: "Technology Landing Page"
lang: "en"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "Bridge"
Expand All @@ -8,7 +7,7 @@ permalink: "user-guide/bridge/"
excerpt: "To start bridging assets from Goerli, navigate to the Bridge app."
---

import ClickToZoom from "../../components/ClickToZoom.astro"
import ClickToZoom from "../../../../components/ClickToZoom.astro"
import bridge1 from "./images/bridge1.png"
import bridge2 from "./images/bridge2.png"
import bridge3 from "./images/bridge3.png"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "Common Errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "Faucet"
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "Alpha Testnet User Guide"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "Setup"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "Transfer Tokens"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: developers
date: Last Modified
title: "Alpha 测试网合约"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: developers
date: Last Modified
title: "开发人员快速入门"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: developers
date: Last Modified
title: "以太坊和 Alpha 测试网的差异"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../../layouts/MainLayout.astro
section: developers
date: Last Modified
title: "合约部署教程"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: developers
date: Last Modified
title: "在Scroll上构建"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: developers
date: Last Modified
title: ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "Scroll 概述"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
---
layout: ../../../layouts/MainLayout.astro
section: learn
title: "学习登陆标题"
lang: "zh"
isMdx: true
---

import ClickToZoom from "../../../components/ClickToZoom.astro"
import priceAggr from "../../../assets/images/contract-devs/price-aggr.png"
import ToggleElement from "../../../components/ToggleElement.astro"
import Aside from "../../../components/Aside.astro"
import ClickToZoom from "../../../../components/ClickToZoom.astro"
import priceAggr from "../../../../assets/images/contract-devs/price-aggr.png"
import ToggleElement from "../../../../components/ToggleElement.astro"
import Aside from "../../../../components/Aside.astro"

Content for the Research landing page. for fancy stuff, see the infrastructure page.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "桥"
Expand All @@ -8,7 +7,7 @@ permalink: "user-guide/bridge/"
excerpt: "To start bridging assets from Goerli, navigate to the Bridge app."
---

import ClickToZoom from "../../../components/ClickToZoom.astro"
import ClickToZoom from "../../../../components/ClickToZoom.astro"
import bridge1 from "./images/bridge1.png"
import bridge2 from "./images/bridge2.png"
import bridge3 from "./images/bridge3.png"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "常见错误"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "水龙头"
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "Alpha 测试网用户指南"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "设置"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: ../../../layouts/MainLayout.astro
section: gettingStarted
date: Last Modified
title: "转移代币"
Expand Down
1 change: 1 addition & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="@astrojs/image/client" />
Loading

0 comments on commit 0863c4f

Please sign in to comment.