diff --git a/docs/content/en/01.index.md b/docs/content/01.index.md similarity index 100% rename from docs/content/en/01.index.md rename to docs/content/01.index.md diff --git a/docs/content/en/02.installation.md b/docs/content/02.installation.md similarity index 99% rename from docs/content/en/02.installation.md rename to docs/content/02.installation.md index 64ebf82c6..250c27912 100644 --- a/docs/content/en/02.installation.md +++ b/docs/content/02.installation.md @@ -49,8 +49,7 @@ The directory structure of a minimal Docus project is the following: ```bash | content/ ----| en/ ------| index.md +---| index.md ---| settings.json | static/ ---| icon.png diff --git a/docs/content/en/2.usage/01.configuration.md b/docs/content/2.usage/01.configuration.md similarity index 100% rename from docs/content/en/2.usage/01.configuration.md rename to docs/content/2.usage/01.configuration.md diff --git a/docs/content/en/2.usage/02.content.md b/docs/content/2.usage/02.content.md similarity index 94% rename from docs/content/en/2.usage/02.content.md rename to docs/content/2.usage/02.content.md index f9c95749d..607d97945 100644 --- a/docs/content/en/2.usage/02.content.md +++ b/docs/content/2.usage/02.content.md @@ -79,7 +79,7 @@ As explained in the [Nuxt config](/usage/configuration#nuxt) section, we use `de ## Routing -Each markdown page in the `content/{locale}/` directory will become a page and will be listed in the left navigation. +Each markdown page in the `content/` directory will become a page and will be listed in the left navigation. > You can also put your markdown files in subdirectories to generate sub-routes. @@ -90,10 +90,9 @@ Each markdown page in the `content/{locale}/` directory will become a page and w ``` content/ - en/ - examples/ - basic-usage.md - setup.md + examples/ + basic-usage.md + setup.md ``` diff --git a/docs/content/en/2.usage/03.components.md b/docs/content/2.usage/03.components.md similarity index 100% rename from docs/content/en/2.usage/03.components.md rename to docs/content/2.usage/03.components.md diff --git a/docs/content/en/2.usage/04.assets.md b/docs/content/2.usage/04.assets.md similarity index 100% rename from docs/content/en/2.usage/04.assets.md rename to docs/content/2.usage/04.assets.md diff --git a/docs/content/en/3.more/01.example.md b/docs/content/3.more/01.example.md similarity index 100% rename from docs/content/en/3.more/01.example.md rename to docs/content/3.more/01.example.md diff --git a/docs/content/en/3.more/02.showcases.md b/docs/content/3.more/02.showcases.md similarity index 100% rename from docs/content/en/3.more/02.showcases.md rename to docs/content/3.more/02.showcases.md diff --git a/docs/content/en/3.more/03.deployment.md b/docs/content/3.more/03.deployment.md similarity index 100% rename from docs/content/en/3.more/03.deployment.md rename to docs/content/3.more/03.deployment.md diff --git a/docs/content/en/3.more/04.migration.md b/docs/content/3.more/04.migration.md similarity index 100% rename from docs/content/en/3.more/04.migration.md rename to docs/content/3.more/04.migration.md diff --git a/theme/module.js b/theme/module.js index f35774e11..caae30756 100644 --- a/theme/module.js +++ b/theme/module.js @@ -74,9 +74,9 @@ export default function docusModule () { const regexp = new RegExp(`^/(${options.i18n.locales.map(locale => locale.code).join('|')})`, 'gi') const { dir, slug, category } = document const _dir = dir.replace(regexp, '') - const _language = dir.replace(_dir, '') + const _language = dir.replace(_dir, '').replace(/\//, '') || options.i18n.defaultLocale const _category = category && typeof category === 'string' ? category : '' - const _to = `${_dir}/${slug}` + const _to = `${_dir}/${slug}`.replace(/\/+/, '/') const position = generatePosition(_to, document) document.slug = generateSlug(slug) diff --git a/theme/pages/_.vue b/theme/pages/_.vue index 7e475f0a6..1c88f7608 100644 --- a/theme/pages/_.vue +++ b/theme/pages/_.vue @@ -39,14 +39,15 @@ export default { } }, async asyncData ({ $content, store, app, params, error }) { - const language = `/${app.i18n.locale}` + const language = app.i18n.locale const to = `/${params.pathMatch || ''}` const [document] = await $content({ deep: true }).where({ language, to }).fetch() if (!document) { return error({ statusCode: 404, message: 'Page not found' }) } - const [prev, next] = await $content(app.i18n.locale, { deep: true }) + const [prev, next] = await $content({ deep: true }) + .where({ language }) .only(['title', 'slug', 'to']) .sortBy('position', 'asc') .surround(document.slug, { before: 1, after: 1 }) diff --git a/theme/plugins/docus.js b/theme/plugins/docus.js index c41b29ce3..ab2471118 100644 --- a/theme/plugins/docus.js +++ b/theme/plugins/docus.js @@ -116,7 +116,7 @@ export default async function ({ app, $content, $config, nuxtState = {}, beforeN if (process.dev === false && this.categories[app.i18n.locale]) { return } - const docs = await $content(app.i18n.locale, { deep: true }).only(['title', 'menuTitle', 'category', 'slug', 'version', 'to']).sortBy('position', 'asc').fetch() + const docs = await $content({ deep: true }).where({ language: app.i18n.locale }).only(['title', 'menuTitle', 'category', 'slug', 'version', 'to']).sortBy('position', 'asc').fetch() if (this.lastRelease) { docs.push({ slug: 'releases', title: 'Releases', category: 'Community', to: '/releases' }) }