Reorganize content and prepare for translation
This commit is contained in:
+13
-3
@@ -2,12 +2,22 @@ import { defineCollection, z } from "astro:content";
|
||||
|
||||
import { glob, file } from "astro/loaders";
|
||||
|
||||
const distroGuide = defineCollection({
|
||||
loader: glob({ pattern: "**/*.mdx", base: "./src/data/distro" }),
|
||||
const commonText = defineCollection({
|
||||
loader: glob({ pattern: "**/*.mdx", base: "./src/data/common" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string().optional(),
|
||||
})
|
||||
});
|
||||
|
||||
export const collections = { distroGuide };
|
||||
const distroGuide = defineCollection({
|
||||
loader: glob({ pattern: "**/*.mdx", base: "./src/data/distro" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string().optional(),
|
||||
aliasOf: z.string().optional(),
|
||||
continueTo: z.string().optional(),
|
||||
})
|
||||
});
|
||||
|
||||
export const collections = { commonText, distroGuide };
|
||||
|
||||
-8
@@ -3,16 +3,8 @@ title: Restart
|
||||
description: Restarting your machine to boot from the USB flash drive
|
||||
---
|
||||
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
|
||||
Next, you'll need to restart your machine to boot from the USB flash drive.
|
||||
|
||||
Please look up the boot menu key for your laptop/mainboard manufacturer and
|
||||
then when restarting, Press that key repeatedly until the "Boot Menu" pops
|
||||
up.
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/2/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
-7
@@ -4,7 +4,6 @@ description: Choose your USB flash drive
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import bootMenu from "@/assets/imgs/Fedora/Boot/MSIBootMenu_Cropped.jpg";
|
||||
|
||||
<figure>
|
||||
@@ -17,9 +16,3 @@ action as it will mostly require fast actions.
|
||||
|
||||
After the boot menu pops up, use the arrow keys (Up/Down) on your keyboard to
|
||||
select the USB flash drive then press Enter.
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/3/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+3
@@ -17,6 +17,9 @@ import welcome from "@/assets/imgs/Fedora/AfterInstall/WelcomeCropped.png";
|
||||
Confirm your language selection and simply click "Next".
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/afterinstall/7/" class="button">
|
||||
I can read this myself! Skip.
|
||||
</a>
|
||||
<a href="/en/distro/fedora/workstation/afterinstall/1/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
+1
-7
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Keyboard Layout
|
||||
continueTo: distro/fedora/workstation/afterinstall/2/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import keyboard from "@/assets/imgs/Fedora/AfterInstall/TypingCropped.png";
|
||||
|
||||
<Picture
|
||||
@@ -17,9 +17,3 @@ import keyboard from "@/assets/imgs/Fedora/AfterInstall/TypingCropped.png";
|
||||
Select your preferred keyboard layout and click "Next".
|
||||
|
||||
(Don't worry bilinguals, You'll be able to add another keyboard layout later!)
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/afterinstall/2/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-7
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Privacy
|
||||
continueTo: distro/fedora/workstation/afterinstall/3/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import welcome from "@/assets/imgs/Fedora/AfterInstall/PrivacyCropped.png";
|
||||
|
||||
<div class="flex justify-center">
|
||||
@@ -20,9 +20,3 @@ Check whether you want location services and automatic problem reporting.
|
||||
|
||||
You can disable the location service if you do not plan to use any apps
|
||||
that rely on your location such as Maps.
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/afterinstall/3/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-7
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: On the topic of time
|
||||
continueTo: distro/fedora/workstation/afterinstall/4/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import timeZone from "@/assets/imgs/Fedora/AfterInstall/TimeZoneCropped.png";
|
||||
|
||||
<Picture
|
||||
@@ -15,9 +15,3 @@ import timeZone from "@/assets/imgs/Fedora/AfterInstall/TimeZoneCropped.png";
|
||||
/>
|
||||
|
||||
Search for your city (or the one near you) to select the time zone.
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/afterinstall/4/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-6
@@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Parties!
|
||||
continueTo: distro/fedora/workstation/afterinstall/5/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
@@ -20,9 +21,3 @@ repositories</span>
|
||||
|
||||
It is recommended that you enable it to ensure access to a wide-variety of
|
||||
software and any drivers that you may need now or in the future.
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/afterinstall/5/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-7
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: What is thy name?
|
||||
continueTo: distro/fedora/workstation/afterinstall/6/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import image from "@/assets/imgs/Fedora/AfterInstall/UsernameCropped.png";
|
||||
|
||||
<div class="flex justify-center">
|
||||
@@ -21,9 +21,3 @@ fancy and username mostly just contains <span
|
||||
class="border-b border-dotted"
|
||||
title="a.k.a numbers and English alphabets">alphanumeric</span> characters
|
||||
under 64 characters in length.
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/afterinstall/6/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-6
@@ -1,5 +1,6 @@
|
||||
---
|
||||
title: "********"
|
||||
continueTo: distro/fedora/workstation/afterinstall/7/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
@@ -19,9 +20,3 @@ import image from "@/assets/imgs/Fedora/AfterInstall/PasswordCropped.png";
|
||||
Set a new password for your new user account. Just use whatever but most
|
||||
importantly, **Don't forget them.** (Write it down in a note somewhere if you
|
||||
must)
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/afterinstall/7/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-7
@@ -1,10 +1,10 @@
|
||||
---
|
||||
title: Hooray
|
||||
continueTo: distro/fedora/workstation/afterinstall/8/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import Party from "@/components/Party.astro";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import image from "@/assets/imgs/Fedora/AfterInstall/OnboardDoneCropped.png";
|
||||
|
||||
<div class="flex justify-center">
|
||||
@@ -18,9 +18,3 @@ import image from "@/assets/imgs/Fedora/AfterInstall/OnboardDoneCropped.png";
|
||||
</div>
|
||||
|
||||
<Party />
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/afterinstall/8/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: Hooray
|
||||
title: Take a tour
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
+1
-7
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Installation
|
||||
description: The steps of installing Fedora Linux
|
||||
continueTo: distro/fedora/workstation/install/1/
|
||||
---
|
||||
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import QRCode from "@/components/QRCode.astro";
|
||||
|
||||
The steps after this will require you to restart the machine you're going to
|
||||
@@ -13,9 +13,3 @@ should likely switch to a phone or other devices.
|
||||
<div class="flex justify-center">
|
||||
<QRCode msg="/en/distro/fedora/workstation/install/0/" width="164" />
|
||||
</div>
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/1/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: Restart
|
||||
description: Restarting your machine to boot from the USB flash drive
|
||||
aliasOf: common/boot/bootmenukey
|
||||
continueTo: distro/fedora/workstation/install/2/
|
||||
---
|
||||
+1
-7
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Sharing is caring
|
||||
continueTo: distro/fedora/workstation/install/12/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import reclaimSpace from "@/assets/imgs/Fedora/Install/ReclaimSpace_Cropped.png";
|
||||
import ResizeIcon from "@/assets/icons/fa-compress-arrows-alt.svg";
|
||||
|
||||
@@ -15,9 +15,3 @@ drive). Click <ResizeIcon
|
||||
class="size-5 inline-block"
|
||||
aria-label="Compress icon" role="img" />
|
||||
to resize.
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/12/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-6
@@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Resize it!
|
||||
continueTo: distro/fedora/workstation/install/13/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
@@ -14,9 +15,3 @@ import reclaimSpace from "@/assets/imgs/Fedora/Install/ReclaimSpaceSlider_Croppe
|
||||
|
||||
Choose a new size for your partition. Please also keep in mind the available
|
||||
space of your partition. Simply click "Resize" after you're done.
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/13/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-7
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Reclaim Territory
|
||||
continueTo: distro/fedora/workstation/install/14/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import reclaimSpace from "@/assets/imgs/Fedora/Install/ReclaimSpaceDone_Cropped.png";
|
||||
|
||||
<Picture
|
||||
@@ -13,9 +13,3 @@ import reclaimSpace from "@/assets/imgs/Fedora/Install/ReclaimSpaceDone_Cropped.
|
||||
/>
|
||||
|
||||
Now, Verify your configuration and click "Reclaim space".
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/14/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-7
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Disk Encryption
|
||||
continueTo: distro/fedora/workstation/install/15/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import diskEncryption from "@/assets/imgs/Fedora/Install/DiskEncryptionUnchecked_Cropped.png";
|
||||
|
||||
<div class="relative">
|
||||
@@ -19,9 +19,3 @@ import diskEncryption from "@/assets/imgs/Fedora/Install/DiskEncryptionUnchecked
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/15/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-6
@@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Review and Install
|
||||
continueTo: distro/fedora/workstation/install/16/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
@@ -17,9 +18,3 @@ import reviewAndInstall from "@/assets/imgs/Fedora/Install/ReviewAndInstall_Crop
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/16/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-7
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Installing...
|
||||
continueTo: distro/fedora/workstation/install/17/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import installing from "@/assets/imgs/Fedora/Install/Installing_Cropped.png";
|
||||
|
||||
<Picture
|
||||
@@ -16,9 +16,3 @@ Patiently wait. Eat some snacks, listen to some music, find something else to do
|
||||
|
||||
This process should take around 5-10 minutes or longer depending on your
|
||||
hardware speed and internet connection.
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/17/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-7
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: You slayed it
|
||||
continueTo: distro/fedora/workstation/install/18/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import installing from "@/assets/imgs/Fedora/Install/InstallationFinished_Cropped.png";
|
||||
|
||||
<Picture
|
||||
@@ -13,9 +13,3 @@ import installing from "@/assets/imgs/Fedora/Install/InstallationFinished_Croppe
|
||||
/>
|
||||
|
||||
Done!
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/18/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-6
@@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Your journey begins anew
|
||||
continueTo: distro/fedora/workstation/afterinstall/0/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
@@ -18,9 +19,3 @@ import restart from "@/assets/imgs/Fedora/Install/RestartMenu_Cropped.png";
|
||||
Now, go to the top right corner of your desktop and click to open the System
|
||||
menu, then press the power button and restart. (Remember this menu, you'll use
|
||||
it often!)
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/afterinstall/0/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: Boot Menu
|
||||
description: Choose your USB flash drive
|
||||
aliasOf: common/boot/bootmenuselect
|
||||
continueTo: distro/fedora/workstation/install/3/
|
||||
---
|
||||
+2
-9
@@ -1,10 +1,9 @@
|
||||
---
|
||||
title: Boot Menu
|
||||
description: Choose your USB flash drive
|
||||
title: Boot Option Restoration
|
||||
continueTo: distro/fedora/workstation/install/4/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import bootOption from "@/assets/imgs/Fedora/Boot/BootOptionRestoration_Cropped.png";
|
||||
|
||||
<div class="relative">
|
||||
@@ -21,9 +20,3 @@ import bootOption from "@/assets/imgs/Fedora/Boot/BootOptionRestoration_Cropped.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/4/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+2
-9
@@ -1,10 +1,9 @@
|
||||
---
|
||||
title: Boot Menu
|
||||
description: Choose your USB flash drive
|
||||
title: Continue Boot
|
||||
continueTo: distro/fedora/workstation/install/5/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import continueBoot from "@/assets/imgs/Fedora/Boot/ContinueBootOption_Cropped.png";
|
||||
|
||||
<div class="relative">
|
||||
@@ -18,9 +17,3 @@ import continueBoot from "@/assets/imgs/Fedora/Boot/ContinueBootOption_Cropped.p
|
||||
press Enter.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/5/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-7
@@ -1,10 +1,10 @@
|
||||
---
|
||||
title: GRUB Menu
|
||||
description: Entering Fedora Linux
|
||||
continueTo: distro/fedora/workstation/install/6/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import continueBoot from "@/assets/imgs/Fedora/Install/GRUB_Cropped.png";
|
||||
|
||||
<div class="relative">
|
||||
@@ -19,9 +19,3 @@ import continueBoot from "@/assets/imgs/Fedora/Install/GRUB_Cropped.png";
|
||||
directly enter the desktop.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/6/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-7
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Integrity Check
|
||||
continueTo: distro/fedora/workstation/install/7/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import check from "@/assets/imgs/Fedora/Install/Check_Cropped.png";
|
||||
|
||||
<Picture
|
||||
@@ -15,9 +15,3 @@ import check from "@/assets/imgs/Fedora/Install/Check_Cropped.png";
|
||||
If you didn't skip the test, You will see this screen.
|
||||
Simply wait for it to complete and you'll go right into
|
||||
the desktop.
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/7/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-6
@@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Welcome
|
||||
continueTo: distro/fedora/workstation/install/8/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
@@ -16,9 +17,3 @@ import overview from "@/assets/imgs/Fedora/Install/Overview.png";
|
||||
Welcome to the desktop! You're in the "Overview" view and you can simply click
|
||||
on the Welcome window to get started in installing Fedora Workstation, or
|
||||
optionally, you could explore and play with it a little first.
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/8/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-7
@@ -1,9 +1,9 @@
|
||||
---
|
||||
title: Install
|
||||
continueTo: distro/fedora/workstation/install/9/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import welcome from "@/assets/imgs/Fedora/Install/Welcome.png";
|
||||
|
||||
<Picture
|
||||
@@ -14,9 +14,3 @@ import welcome from "@/assets/imgs/Fedora/Install/Welcome.png";
|
||||
/>
|
||||
|
||||
So, let's get started on the real installation. Click "Install Fedora..."
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/9/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
+1
-6
@@ -1,5 +1,6 @@
|
||||
---
|
||||
title: Language
|
||||
continueTo: distro/fedora/workstation/install/10/
|
||||
---
|
||||
|
||||
import { Picture } from "astro:assets";
|
||||
@@ -14,9 +15,3 @@ import language from "@/assets/imgs/Fedora/Install/Install_Language.png";
|
||||
/>
|
||||
|
||||
Select your preferred language and click Next.
|
||||
|
||||
<ChoiceList>
|
||||
<a href="/en/distro/fedora/workstation/install/10/" class="button">
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
@@ -0,0 +1,123 @@
|
||||
---
|
||||
import type { GetStaticPaths } from "astro";
|
||||
import BasicLayout from "@/layouts/BasicLayout.astro";
|
||||
import distroQuizDialogs from "@/data/distroquiz";
|
||||
import { getRelativeLocaleUrl } from "astro:i18n";
|
||||
import fedoraDialogs from "@/data/distro/en/fedora/fedora";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
export const getStaticPaths = (async () => {
|
||||
const docs = await getCollection("distroGuide");
|
||||
|
||||
const langs = docs.reduce((prev, curr) => {
|
||||
const lang = curr.id.split("/")[0];
|
||||
prev.add(lang);
|
||||
return prev;
|
||||
}, new Set<string>());
|
||||
|
||||
return Array.from(langs).map((v) => ({
|
||||
params: {
|
||||
lang: v,
|
||||
},
|
||||
}));
|
||||
}) satisfies GetStaticPaths;
|
||||
|
||||
const { lang } = Astro.params;
|
||||
|
||||
const docs = await getCollection("distroGuide");
|
||||
|
||||
type Tree = { [key: string]: Tree | string };
|
||||
|
||||
const tree: Tree = {};
|
||||
|
||||
// Inspired from https://stackoverflow.com/a/62740661/14512055
|
||||
for (const doc of docs) {
|
||||
let ptr = tree;
|
||||
const [_, ...slug] = doc.id.split("/");
|
||||
const last = slug.pop() ?? "";
|
||||
|
||||
for (const part of slug) {
|
||||
ptr = ptr[part] = (ptr[part] as Tree) || {};
|
||||
}
|
||||
|
||||
ptr[last] = /[0-9]+/.test(last) ? doc.data.title : {};
|
||||
}
|
||||
|
||||
for (let i = 0; i < fedoraDialogs.length; i++) {
|
||||
// @ts-ignore
|
||||
tree["fedora"][i.toString()] = fedoraDialogs[i].title;
|
||||
}
|
||||
|
||||
function visualizeTree(tree: Tree, key: string | null, prefix: string): string {
|
||||
const subcategories = [];
|
||||
const children = [];
|
||||
|
||||
for (const key in tree) {
|
||||
const value = tree[key];
|
||||
|
||||
if (typeof value === "string") {
|
||||
children.push(`<li>
|
||||
<a href="${`${lang}/distro/${prefix}${key}`}">${value}</a>
|
||||
</li>`);
|
||||
} else {
|
||||
subcategories.push(visualizeTree(value, key, `${prefix}${key}/`));
|
||||
}
|
||||
}
|
||||
|
||||
if (key === null) {
|
||||
return `<div>
|
||||
${subcategories.join("")}
|
||||
<ul>${children.join("")}</ul>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
return `<details>
|
||||
<summary>${key}</summary>
|
||||
${subcategories.join("")}
|
||||
<ul>${children.join("")}</ul>
|
||||
</details>`;
|
||||
}
|
||||
|
||||
const visualization = visualizeTree(tree, null, "");
|
||||
---
|
||||
|
||||
<BasicLayout title="Table of Contents">
|
||||
<main class="mx-16 my-8">
|
||||
<details id="distroquiz">
|
||||
<summary>distroquiz</summary>
|
||||
<ul>
|
||||
{
|
||||
distroQuizDialogs.map((v, i) => (
|
||||
<li>
|
||||
<a
|
||||
href={getRelativeLocaleUrl(
|
||||
lang,
|
||||
`distroquiz/${i}`
|
||||
)}
|
||||
>
|
||||
{v.title}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</details>
|
||||
<Fragment set:html={visualization} />
|
||||
</main>
|
||||
</BasicLayout>
|
||||
|
||||
<style>
|
||||
@reference "@/styles/global.css";
|
||||
|
||||
:global(ul) {
|
||||
@apply list-disc ps-8;
|
||||
}
|
||||
|
||||
:global(a) {
|
||||
@apply border-b border-b-gray-400 dark:border-b-slate-400 hover:dark:text-sky-200 hover:text-sky-900 transition-colors;
|
||||
}
|
||||
|
||||
:global(details) {
|
||||
@apply px-4 py-2 my-2 border dark:border-slate-700 border-gray-300 rounded;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
import ChoiceList from "@/components/ChoiceList.astro";
|
||||
import TransitionLayout from "@/layouts/TransitionLayout.astro";
|
||||
import type { GetStaticPaths } from "astro";
|
||||
import type { CollectionEntry } from "astro:content";
|
||||
import { getEntry } from "astro:content";
|
||||
import { getCollection, render } from "astro:content";
|
||||
import { getRelativeLocaleUrl } from "astro:i18n";
|
||||
|
||||
export const getStaticPaths = (async () => {
|
||||
const docs = await getCollection("distroGuide");
|
||||
|
||||
return docs.map((doc) => {
|
||||
const [lang, ...slug] = doc.id.split("/");
|
||||
return {
|
||||
params: { lang, id: slug.join("/") || undefined },
|
||||
props: { doc },
|
||||
};
|
||||
});
|
||||
}) satisfies GetStaticPaths;
|
||||
|
||||
const { lang } = Astro.params;
|
||||
const { doc } = Astro.props;
|
||||
|
||||
let contentDoc: CollectionEntry<"commonText" | "distroGuide"> = doc;
|
||||
|
||||
const commonPrefix = "common/";
|
||||
if (doc.data.aliasOf && doc.data.aliasOf.startsWith(commonPrefix)) {
|
||||
const entry = await getEntry(
|
||||
"commonText",
|
||||
`${lang}/${doc.data.aliasOf.substring(commonPrefix.length)}`
|
||||
);
|
||||
|
||||
if (entry !== undefined) {
|
||||
contentDoc = entry;
|
||||
}
|
||||
}
|
||||
|
||||
const { Content } = await render(contentDoc);
|
||||
---
|
||||
|
||||
<TransitionLayout
|
||||
title={doc.data.title + " - Move to Linux"}
|
||||
description={doc.data.description}
|
||||
>
|
||||
<main class="fill-screen-center" transition:animate="fade">
|
||||
<div class="p-4 lg:max-w-[50vw] text-center flex flex-col gap-4">
|
||||
<h1 class="text-5xl font-bold">{doc.data.title}</h1>
|
||||
<Content />
|
||||
{
|
||||
doc.data.continueTo === undefined ? null : (
|
||||
<ChoiceList>
|
||||
<a
|
||||
href={getRelativeLocaleUrl(
|
||||
lang,
|
||||
doc.data.continueTo
|
||||
)}
|
||||
class="button"
|
||||
>
|
||||
Continue
|
||||
</a>
|
||||
</ChoiceList>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</main>
|
||||
</TransitionLayout>
|
||||
@@ -1,140 +0,0 @@
|
||||
---
|
||||
import BasicLayout from "@/layouts/BasicLayout.astro";
|
||||
import distroQuizDialogs from "@/data/distroquiz";
|
||||
import { getRelativeLocaleUrl } from "astro:i18n";
|
||||
import fedoraDialogs from "@/data/distro/fedora/fedora";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
const docs = await getCollection("distroGuide");
|
||||
---
|
||||
|
||||
<BasicLayout title="Table of Contents">
|
||||
<main class="mx-16 my-8">
|
||||
<details id="distroquiz">
|
||||
<summary>distroquiz</summary>
|
||||
<ul>
|
||||
{
|
||||
distroQuizDialogs.map((v, i) => (
|
||||
<li>
|
||||
<a
|
||||
href={getRelativeLocaleUrl(
|
||||
"en",
|
||||
`distroquiz/${i}`
|
||||
)}
|
||||
>
|
||||
{v.title}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</details>
|
||||
<details id="fedora">
|
||||
<summary>Fedora Linux</summary>
|
||||
<details id="fedoraWorkstation">
|
||||
<summary>Fedora Workstation</summary>
|
||||
<ul>
|
||||
{
|
||||
docs
|
||||
.filter((v) => {
|
||||
const index = v.id.substring(19);
|
||||
return !Number.isNaN(parseInt(index));
|
||||
})
|
||||
.map((v, i) => (
|
||||
<li>
|
||||
<a
|
||||
href={getRelativeLocaleUrl(
|
||||
"en",
|
||||
`distro/${v.id}`
|
||||
)}
|
||||
>
|
||||
{v.data.title}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
<details id="fedoraWorkstationInstall">
|
||||
<summary>Installation</summary>
|
||||
<ul>
|
||||
{
|
||||
docs
|
||||
.filter((v) => {
|
||||
const index = v.id.substring(27);
|
||||
return !Number.isNaN(parseInt(index));
|
||||
})
|
||||
.map((v, i) => (
|
||||
<li>
|
||||
<a
|
||||
href={getRelativeLocaleUrl(
|
||||
"en",
|
||||
`distro/${v.id}`
|
||||
)}
|
||||
>
|
||||
{v.data.title}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</details>
|
||||
<details id="fedoraWorkstationAfterInstall">
|
||||
<summary>After Installation</summary>
|
||||
<ul>
|
||||
{
|
||||
docs
|
||||
.filter((v) => {
|
||||
const index = v.id.substring(32);
|
||||
return !Number.isNaN(parseInt(index));
|
||||
})
|
||||
.map((v, i) => (
|
||||
<li>
|
||||
<a
|
||||
href={getRelativeLocaleUrl(
|
||||
"en",
|
||||
`distro/${v.id}`
|
||||
)}
|
||||
>
|
||||
{v.data.title}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</details>
|
||||
</details>
|
||||
<ul>
|
||||
{
|
||||
fedoraDialogs.map((v, i) => (
|
||||
<li>
|
||||
<a
|
||||
href={getRelativeLocaleUrl(
|
||||
"en",
|
||||
`distro/fedora/${i}`
|
||||
)}
|
||||
>
|
||||
{v.title}
|
||||
</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</details>
|
||||
</main>
|
||||
</BasicLayout>
|
||||
|
||||
<style>
|
||||
@reference "@/styles/global.css";
|
||||
|
||||
ul {
|
||||
@apply list-disc ps-8;
|
||||
}
|
||||
|
||||
a {
|
||||
@apply border-b border-b-gray-400 dark:border-b-slate-400 hover:dark:text-sky-200 hover:text-sky-900 transition-colors;
|
||||
}
|
||||
|
||||
details {
|
||||
@apply px-4 py-2 my-2 border dark:border-slate-700 border-gray-300 rounded;
|
||||
}
|
||||
</style>
|
||||
@@ -1,29 +0,0 @@
|
||||
---
|
||||
import TransitionLayout from "@/layouts/TransitionLayout.astro";
|
||||
import type { GetStaticPaths } from "astro";
|
||||
import { getCollection, render } from "astro:content";
|
||||
|
||||
export const getStaticPaths = (async () => {
|
||||
const docs = await getCollection("distroGuide");
|
||||
|
||||
return docs.map((doc) => ({
|
||||
params: { id: doc.id },
|
||||
props: { doc },
|
||||
}));
|
||||
}) satisfies GetStaticPaths;
|
||||
|
||||
const { doc } = Astro.props;
|
||||
const { Content } = await render(doc);
|
||||
---
|
||||
|
||||
<TransitionLayout
|
||||
title={doc.data.title + " - Move to Linux"}
|
||||
description={doc.data.description}
|
||||
>
|
||||
<main class="fill-screen-center" transition:animate="fade">
|
||||
<div class="p-4 lg:max-w-[50vw] text-center flex flex-col gap-4">
|
||||
<h1 class="text-5xl font-bold">{doc.data.title}</h1>
|
||||
<Content />
|
||||
</div>
|
||||
</main>
|
||||
</TransitionLayout>
|
||||
@@ -2,7 +2,7 @@
|
||||
import TransitionLayout from "@/layouts/TransitionLayout.astro";
|
||||
import { getChoices, mapStaticPaths } from "@/lib/tinyvn";
|
||||
import type { GetStaticPaths } from "astro";
|
||||
import dialogs from "@/data/distro/fedora/fedora";
|
||||
import dialogs from "@/data/distro/en/fedora/fedora";
|
||||
|
||||
export const getStaticPaths = (() => {
|
||||
return mapStaticPaths(dialogs);
|
||||
|
||||
Reference in New Issue
Block a user