{"id":19248275,"url":"https://github.com/tlbootcamp/vuepress-plugin-locale-prefix","last_synced_at":"2025-08-20T05:06:45.473Z","repository":{"id":39145920,"uuid":"259965619","full_name":"tlbootcamp/vuepress-plugin-locale-prefix","owner":"tlbootcamp","description":"VuePress plugin which replaces /path/%locale%.html paths to /%locale%/path.html","archived":false,"fork":false,"pushed_at":"2023-01-07T17:39:10.000Z","size":2029,"stargazers_count":0,"open_issues_count":21,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-15T22:21:32.310Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tlbootcamp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-29T15:31:06.000Z","updated_at":"2022-09-23T14:33:34.000Z","dependencies_parsed_at":"2023-02-07T18:31:18.606Z","dependency_job_id":null,"html_url":"https://github.com/tlbootcamp/vuepress-plugin-locale-prefix","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tlbootcamp/vuepress-plugin-locale-prefix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlbootcamp%2Fvuepress-plugin-locale-prefix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlbootcamp%2Fvuepress-plugin-locale-prefix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlbootcamp%2Fvuepress-plugin-locale-prefix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlbootcamp%2Fvuepress-plugin-locale-prefix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tlbootcamp","download_url":"https://codeload.github.com/tlbootcamp/vuepress-plugin-locale-prefix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlbootcamp%2Fvuepress-plugin-locale-prefix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271268854,"owners_count":24730024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T18:07:12.475Z","updated_at":"2025-08-20T05:06:45.447Z","avatar_url":"https://github.com/tlbootcamp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003evuepress-plugin-locale-prefix\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n\nVuePress plugin which replaces `/path/%locale%.html` paths to `/%locale%/path.html`\n\n![Version](https://img.shields.io/npm/v/@b0g3r/vuepress-plugin-locale-prefix?style=flat-square)\n![License](https://img.shields.io/npm/l/@b0g3r/vuepress-plugin-locale-prefix?style=flat-square)\n\n\u003c/div\u003e\n\n## Sorry, plugin for what?\n\nI know, it sounds strange, but sometimes you need this.\n\nFor example you have a big site with project documentation and deep directory nesting:\n```\ndocumentation\n|-- how-to-use\n    `-- dependencies\n        `-- ubuntu-requirements\n            `-- index.md\n...\n```\n\nYour urls looks great, hah? `/documentation/how-to-use/dependencies/ubuntu-requirements` 😍\n\nSo, the next step for your big site is internationalization (`i18n`). The classic way to do it is create first-level directories for each locale:\n```\nen\n|-- documentation\n    `-- how-to-use\n        `-- dependencies\n            `-- ubuntu-requirements\n                `-- index.md  # English doc about ubuntu requirements\nru\n|-- documentation\n    `-- how-to-use\n        `-- dependencies\n            `-- ubuntu-requirements\n                `-- index.md  # Russian doc about ubuntu requirements\n```\n\nWith deep nesting it's very painful to maintain directory tree, because you should duplicate structure for each locale. \n\n... Okay, but what if we try something like **this**?\n\n```\ndocumentation\n|-- how-to-use\n    `-- dependencies\n        `-- ubuntu-requirements\n            |-- en.md  # English doc about ubuntu requirements\n            `-- ru.md  # Russian doc about ubuntu requirements\n...\n```\n\nIn this case we have only one directory tree, but now urls are awful and not SEO friendly: `/documentation/how-to-use/dependencies/ubuntu-requirements/en.html`\n\nSo, my plugin is solution for the problem, it replaces `/documentation/how-to-use/dependencies/ubuntu-requirements/en.html` to `/en/documentation/how-to-use/dependencies/ubuntu-requirements.html` 🎉\n\nPlugin also supports _default locale_, when you want to host one locale as `/`, and others as `/%locale%/`, see \"Options\" \n\nPlugin created especially for [Teamlead Roadmap project](https://github.com/tlbootcamp/tlroadmap)\n\n## Install\n\n```sh\nyarn add -D @b0g3r/vuepress-plugin-locale-prefix\n# OR npm install -D @b0g3r/vuepress-plugin-locale-prefix\n```\n\n## Usage\n**Note:** plugin should be places as high as possible, especially before any plugin that can change page.path or page.regularPath attributes (e.g. `clean-urls`) \n\n```js\nmodule.exports = {\n  plugins: [\n    ['@b0g3r/locale-prefix',{\n      locales: new Map([\n        ['en', '/en/'],\n        ['ru', '/'],\n      ]) \n    }]\n  ]\n}\n```\n\n## Options\n\n### locales (required)\n- Type: `Map\u003cstring, string\u003e`\n\nSet mapping of filename → pathPrefix. For example `Map('en' → '/en/', 'ru' → '/')` will host all `en.md` files with root prefix `/en/` and all `ru.md` with root prefix `/`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlbootcamp%2Fvuepress-plugin-locale-prefix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftlbootcamp%2Fvuepress-plugin-locale-prefix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlbootcamp%2Fvuepress-plugin-locale-prefix/lists"}