一旦初期化
This commit is contained in:
commit
60c08caf8e
|
@ -0,0 +1,2 @@
|
|||
/node_modules/
|
||||
/.vitepress/cache/
|
|
@ -0,0 +1,47 @@
|
|||
import { defineConfig } from "vitepress";
|
||||
|
||||
// https://vitepress.dev/reference/site-config
|
||||
export default defineConfig({
|
||||
title: "Peas",
|
||||
description: "Profiles SNS",
|
||||
lang: "ja",
|
||||
|
||||
themeConfig: {
|
||||
nav: [
|
||||
{ text: "Home", link: "/" },
|
||||
{ text: "Examples", link: "/markdown-examples" },
|
||||
],
|
||||
sidebar: [
|
||||
{
|
||||
text: "Examples",
|
||||
items: [
|
||||
{ text: "Markdown Examples", link: "/markdown-examples" },
|
||||
{ text: "Runtime API Examples", link: "/api-examples" },
|
||||
],
|
||||
},
|
||||
],
|
||||
socialLinks: [
|
||||
{
|
||||
icon: "gitea",
|
||||
link: "https://gitea.last2014.f5.si/peas-dev/peas",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
locales: {
|
||||
root: {
|
||||
label: "",
|
||||
lang: "ja",
|
||||
},
|
||||
ja: {
|
||||
label: "Japanese",
|
||||
lang: "ja",
|
||||
link: "/ja",
|
||||
},
|
||||
en: {
|
||||
label: "English",
|
||||
lang: "en",
|
||||
link: "/en",
|
||||
},
|
||||
},
|
||||
});
|
|
@ -0,0 +1,73 @@
|
|||
<template>
|
||||
<DefaultTheme.Layout />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { watch, onMounted, nextTick } from "vue";
|
||||
import { useData, inBrowser } from "vitepress";
|
||||
import DefaultTheme from "vitepress/theme";
|
||||
|
||||
const data = useData();
|
||||
|
||||
const performRedirect = (targetLocale: string, currentPath: string) => {
|
||||
const pathWithoutLocale = currentPath.replace(/^\/(?:ja|en)(\/|$)/, "/");
|
||||
|
||||
const newPath =
|
||||
pathWithoutLocale === "/"
|
||||
? `/${targetLocale}`
|
||||
: `/${targetLocale}${pathWithoutLocale}`;
|
||||
|
||||
if (newPath !== currentPath) {
|
||||
console.log(`Redirecting from ${currentPath} to ${newPath}`);
|
||||
window.location.replace(newPath);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (!inBrowser) return;
|
||||
|
||||
const path = window.location.pathname;
|
||||
const savedLocale = localStorage.getItem("locale") || "ja";
|
||||
|
||||
const pathLocaleMatch = path.match(/^\/(?:ja|en)(?:\/|$)/);
|
||||
const currentPathLocale = pathLocaleMatch ? path.substring(1, 3) : null;
|
||||
|
||||
if (currentPathLocale) {
|
||||
localStorage.setItem("locale", currentPathLocale);
|
||||
}
|
||||
|
||||
if (path === "/" || path === "" || !currentPathLocale) {
|
||||
performRedirect(savedLocale, path);
|
||||
}
|
||||
});
|
||||
|
||||
watch(
|
||||
data.lang,
|
||||
async (newLang, oldLang) => {
|
||||
if (!inBrowser || !newLang || newLang === oldLang) return;
|
||||
|
||||
await nextTick();
|
||||
|
||||
const currentPath = window.location.pathname;
|
||||
const savedLocale = localStorage.getItem("locale");
|
||||
|
||||
if (newLang !== savedLocale) {
|
||||
localStorage.setItem("locale", newLang);
|
||||
}
|
||||
|
||||
const pathLocaleMatch = currentPath.match(/^\/(?:ja|en)(?:\/|$)/);
|
||||
const currentPathLocale = pathLocaleMatch
|
||||
? currentPath.substring(1, 3)
|
||||
: null;
|
||||
|
||||
if (currentPathLocale !== newLang) {
|
||||
setTimeout(() => {
|
||||
performRedirect(newLang, currentPath);
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
{ flush: "post" },
|
||||
);
|
||||
</script>
|
|
@ -0,0 +1,8 @@
|
|||
// https://vitepress.dev/guide/custom-theme
|
||||
import DefaultTheme from "vitepress/theme";
|
||||
import Layout from "./Layout.vue";
|
||||
|
||||
export default {
|
||||
extends: DefaultTheme,
|
||||
Layout,
|
||||
};
|
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
outline: deep
|
||||
---
|
||||
|
||||
# Runtime API Examples
|
||||
|
||||
This page demonstrates usage of some of the runtime APIs provided by VitePress.
|
||||
|
||||
The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
|
||||
|
||||
```md
|
||||
<script setup>
|
||||
import { useData } from 'vitepress'
|
||||
|
||||
const { theme, page, frontmatter } = useData()
|
||||
</script>
|
||||
|
||||
## Results
|
||||
|
||||
### Theme Data
|
||||
<pre>{{ theme }}</pre>
|
||||
|
||||
### Page Data
|
||||
<pre>{{ page }}</pre>
|
||||
|
||||
### Page Frontmatter
|
||||
<pre>{{ frontmatter }}</pre>
|
||||
```
|
||||
|
||||
<script setup>
|
||||
import { useData } from 'vitepress'
|
||||
|
||||
const { site, theme, page, frontmatter } = useData()
|
||||
</script>
|
||||
|
||||
## Results
|
||||
|
||||
### Theme Data
|
||||
<pre>{{ theme }}</pre>
|
||||
|
||||
### Page Data
|
||||
<pre>{{ page }}</pre>
|
||||
|
||||
### Page Frontmatter
|
||||
<pre>{{ frontmatter }}</pre>
|
||||
|
||||
## More
|
||||
|
||||
Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
|
|
@ -0,0 +1,85 @@
|
|||
# Markdown Extension Examples
|
||||
|
||||
This page demonstrates some of the built-in markdown extensions provided by VitePress.
|
||||
|
||||
## Syntax Highlighting
|
||||
|
||||
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
|
||||
|
||||
**Input**
|
||||
|
||||
````md
|
||||
```js{4}
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
msg: 'Highlighted!'
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
````
|
||||
|
||||
**Output**
|
||||
|
||||
```js{4}
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
msg: 'Highlighted!'
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Custom Containers
|
||||
|
||||
**Input**
|
||||
|
||||
```md
|
||||
::: info
|
||||
This is an info box.
|
||||
:::
|
||||
|
||||
::: tip
|
||||
This is a tip.
|
||||
:::
|
||||
|
||||
::: warning
|
||||
This is a warning.
|
||||
:::
|
||||
|
||||
::: danger
|
||||
This is a dangerous warning.
|
||||
:::
|
||||
|
||||
::: details
|
||||
This is a details block.
|
||||
:::
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
::: info
|
||||
This is an info box.
|
||||
:::
|
||||
|
||||
::: tip
|
||||
This is a tip.
|
||||
:::
|
||||
|
||||
::: warning
|
||||
This is a warning.
|
||||
:::
|
||||
|
||||
::: danger
|
||||
This is a dangerous warning.
|
||||
:::
|
||||
|
||||
::: details
|
||||
This is a details block.
|
||||
:::
|
||||
|
||||
## More
|
||||
|
||||
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
# https://vitepress.dev/reference/default-theme-home-page
|
||||
layout: home
|
||||
|
||||
hero:
|
||||
name: "Peas"
|
||||
text: "Profiles SNS"
|
||||
tagline: My great project tagline
|
||||
actions:
|
||||
- theme: brand
|
||||
text: Markdown Examples
|
||||
link: ./markdown-examples
|
||||
- theme: alt
|
||||
text: API Examples
|
||||
link: ./api-examples
|
||||
|
||||
features:
|
||||
- title: Feature A
|
||||
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
||||
- title: Feature B
|
||||
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
||||
- title: Feature C
|
||||
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
||||
---
|
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
outline: deep
|
||||
---
|
||||
|
||||
# Runtime API Examples
|
||||
|
||||
This page demonstrates usage of some of the runtime APIs provided by VitePress.
|
||||
|
||||
The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
|
||||
|
||||
```md
|
||||
<script setup>
|
||||
import { useData } from 'vitepress'
|
||||
|
||||
const { theme, page, frontmatter } = useData()
|
||||
</script>
|
||||
|
||||
## Results
|
||||
|
||||
### Theme Data
|
||||
<pre>{{ theme }}</pre>
|
||||
|
||||
### Page Data
|
||||
<pre>{{ page }}</pre>
|
||||
|
||||
### Page Frontmatter
|
||||
<pre>{{ frontmatter }}</pre>
|
||||
```
|
||||
|
||||
<script setup>
|
||||
import { useData } from 'vitepress'
|
||||
|
||||
const { site, theme, page, frontmatter } = useData()
|
||||
</script>
|
||||
|
||||
## Results
|
||||
|
||||
### Theme Data
|
||||
<pre>{{ theme }}</pre>
|
||||
|
||||
### Page Data
|
||||
<pre>{{ page }}</pre>
|
||||
|
||||
### Page Frontmatter
|
||||
<pre>{{ frontmatter }}</pre>
|
||||
|
||||
## More
|
||||
|
||||
Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
|
|
@ -0,0 +1,85 @@
|
|||
# Markdown Extension Examples
|
||||
|
||||
This page demonstrates some of the built-in markdown extensions provided by VitePress.
|
||||
|
||||
## Syntax Highlighting
|
||||
|
||||
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
|
||||
|
||||
**Input**
|
||||
|
||||
````md
|
||||
```js{4}
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
msg: 'Highlighted!'
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
````
|
||||
|
||||
**Output**
|
||||
|
||||
```js{4}
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
msg: 'Highlighted!'
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Custom Containers
|
||||
|
||||
**Input**
|
||||
|
||||
```md
|
||||
::: info
|
||||
This is an info box.
|
||||
:::
|
||||
|
||||
::: tip
|
||||
This is a tip.
|
||||
:::
|
||||
|
||||
::: warning
|
||||
This is a warning.
|
||||
:::
|
||||
|
||||
::: danger
|
||||
This is a dangerous warning.
|
||||
:::
|
||||
|
||||
::: details
|
||||
This is a details block.
|
||||
:::
|
||||
```
|
||||
|
||||
**Output**
|
||||
|
||||
::: info
|
||||
This is an info box.
|
||||
:::
|
||||
|
||||
::: tip
|
||||
This is a tip.
|
||||
:::
|
||||
|
||||
::: warning
|
||||
This is a warning.
|
||||
:::
|
||||
|
||||
::: danger
|
||||
This is a dangerous warning.
|
||||
:::
|
||||
|
||||
::: details
|
||||
This is a details block.
|
||||
:::
|
||||
|
||||
## More
|
||||
|
||||
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
# https://vitepress.dev/reference/default-theme-home-page
|
||||
layout: home
|
||||
|
||||
hero:
|
||||
name: "Peas"
|
||||
text: "プロフィールSNS"
|
||||
tagline: プロフィールを簡単に作成して共有
|
||||
actions:
|
||||
- theme: brand
|
||||
text: 今すぐ使う
|
||||
link: /docs/
|
||||
- theme: alt
|
||||
text: API Examples
|
||||
link: ./api-examples
|
||||
|
||||
features:
|
||||
- title: Feature A
|
||||
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
||||
- title: Feature B
|
||||
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
||||
- title: Feature C
|
||||
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
|
||||
---
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "peas-website",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vitepress dev .",
|
||||
"build": "vitepress build .",
|
||||
"preview": "vitepress preview ."
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"vitepress": "^1.6.3"
|
||||
}
|
||||
}
|
Reference in New Issue