Summary (required)
This commit is contained in:
parent
fbd130eb8b
commit
44eabc1a09
23
src/components/Navbar.astro
Normal file
23
src/components/Navbar.astro
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
import Navlink from "./Navlink.astro";
|
||||||
|
const links = [
|
||||||
|
{
|
||||||
|
display: "Home",
|
||||||
|
icon: "H",
|
||||||
|
href: "/"
|
||||||
|
},{
|
||||||
|
display: "Blog",
|
||||||
|
icon: "B",
|
||||||
|
href: "/blog"
|
||||||
|
}, {
|
||||||
|
display: "About",
|
||||||
|
icon: "A",
|
||||||
|
href: "/about"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
---
|
||||||
|
<nav class="bg-white w-full flex justify-center">
|
||||||
|
<div class="justify-around w-full md:w-[767px] flex">
|
||||||
|
{ links.map((item) => (<Navlink href={item.href}, display={item.display}, icon={item.icon} isActive={ (Astro.url.pathname.replace(Astro.currentLocale + "/", "").slice(0,-1) || "/") == item.href}/>)) }
|
||||||
|
</div>
|
||||||
|
</nav>
|
6
src/components/Navlink.astro
Normal file
6
src/components/Navlink.astro
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
import { getRelativeLocaleUrl } from "astro:i18n";
|
||||||
|
|
||||||
|
const { display, href, icon, isActive } = Astro.props;
|
||||||
|
---
|
||||||
|
<a href={getRelativeLocaleUrl(Astro.currentLocale, href)} class={(isActive ? "bg-yellow-300 " : " ") + "w-full text-center"}><span class="hidden lg:visible">{icon}</span><span>{display}</span></a>
|
@ -1,2 +0,0 @@
|
|||||||
export const SITE_TITLE = 'Astro Blog';
|
|
||||||
export const SITE_DESCRIPTION = 'Welcome to my website!';
|
|
@ -1,5 +1,7 @@
|
|||||||
---
|
---
|
||||||
const { title, description, lang } = Astro.props;
|
const { title, description, lang } = Astro.props;
|
||||||
|
import Navbar from "../components/Navbar.astro";
|
||||||
|
import "../style/index.css";
|
||||||
---
|
---
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang={lang}>
|
<html lang={lang}>
|
||||||
@ -9,7 +11,8 @@ const { title, description, lang } = Astro.props;
|
|||||||
<meta name="description" content={description}>
|
<meta name="description" content={description}>
|
||||||
<title>{title}</title>
|
<title>{title}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="bg-bkg">
|
||||||
|
<Navbar />
|
||||||
<slot/>
|
<slot/>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
16
src/pages/[lang]/about/index.astro
Normal file
16
src/pages/[lang]/about/index.astro
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
import MainLayout from "../../../layouts/MainLayout.astro";
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
|
import { dictionary } from "../../../i18n/dictionary";
|
||||||
|
const { title, description } = dictionary[Astro.currentLocale];
|
||||||
|
|
||||||
|
export async function getStaticPaths() {
|
||||||
|
return ["en", "fr", "cs", "de"].map((lang) => {
|
||||||
|
return { params: { lang } };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
---
|
||||||
|
<MainLayout title={title} description={description} lang={Astro.currentLocale}>
|
||||||
|
|
||||||
|
</MainLayout>
|
16
src/pages/[lang]/blog/index.astro
Normal file
16
src/pages/[lang]/blog/index.astro
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
import MainLayout from "../../../layouts/MainLayout.astro";
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
|
import { dictionary } from "../../../i18n/dictionary";
|
||||||
|
const { title, description } = dictionary[Astro.currentLocale];
|
||||||
|
|
||||||
|
export async function getStaticPaths() {
|
||||||
|
return ["en", "fr", "cs", "de"].map((lang) => {
|
||||||
|
return { params: { lang } };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
---
|
||||||
|
<MainLayout title={title} description={description} lang={Astro.currentLocale}>
|
||||||
|
|
||||||
|
</MainLayout>
|
@ -1,8 +1,9 @@
|
|||||||
---
|
---
|
||||||
import { getLocaleByPath } from "astro:i18n";
|
|
||||||
import MainLayout from "../../layouts/MainLayout.astro";
|
import MainLayout from "../../layouts/MainLayout.astro";
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
import { dictionary } from "../../i18n/dictionary";
|
import { dictionary } from "../../i18n/dictionary";
|
||||||
const { title } = dictionary[Astro.currentLocale];
|
const { title, description } = dictionary[Astro.currentLocale];
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
return ["en", "fr", "cs", "de"].map((lang) => {
|
return ["en", "fr", "cs", "de"].map((lang) => {
|
||||||
@ -10,10 +11,6 @@ export async function getStaticPaths() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
<MainLayout title={title} description={description} lang={Astro.currentLocale}>
|
||||||
|
|
||||||
<MainLayout title={title} description="sitedescription" lang={Astro.currentLocale}>
|
|
||||||
<h1>Welcome</h1>
|
|
||||||
<p>
|
|
||||||
{Astro.url.toString()}
|
|
||||||
</p>
|
|
||||||
</MainLayout>
|
</MainLayout>
|
Loading…
Reference in New Issue
Block a user