{"id":28070142,"url":"https://github.com/neverbot/hexo-multilang","last_synced_at":"2025-05-12T19:38:12.418Z","repository":{"id":50253061,"uuid":"250833485","full_name":"neverbot/hexo-multilang","owner":"neverbot","description":"Multi-language plugin for Hexo. Helps you manage a web whose contents are written in different languages.","archived":false,"fork":false,"pushed_at":"2022-01-11T17:32:07.000Z","size":201,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-04-24T21:09:27.290Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/neverbot.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-03-28T15:45:50.000Z","updated_at":"2023-12-21T12:30:12.000Z","dependencies_parsed_at":"2022-09-05T15:11:27.357Z","dependency_job_id":null,"html_url":"https://github.com/neverbot/hexo-multilang","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neverbot%2Fhexo-multilang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neverbot%2Fhexo-multilang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neverbot%2Fhexo-multilang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neverbot%2Fhexo-multilang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neverbot","download_url":"https://codeload.github.com/neverbot/hexo-multilang/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253808915,"owners_count":21967618,"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","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":"2025-05-12T19:38:11.976Z","updated_at":"2025-05-12T19:38:12.407Z","avatar_url":"https://github.com/neverbot.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hexo-multilang\n\n[![npm](https://img.shields.io/npm/dt/hexo-multilang)](https://www.npmjs.com/package/hexo-multilang)\n[![npm](https://img.shields.io/npm/dw/hexo-multilang)](https://www.npmjs.com/package/hexo-multilang)\n[![GitHub license](https://img.shields.io/github/license/neverbot/hexo-multilang)](https://github.com/neverbot/hexo-multilang/blob/master/license.md)\n[![npm](https://img.shields.io/npm/v/hexo-multilang)](https://www.npmjs.com/package/hexo-multilang)\n\n| :warning: | *This project has been abandoned*: It was created to manage an Hexo web page with contents written in multiple languages (every page and post were repeated in every language, and you could switch between languages to see the different contents). I was managing a webpage with such needs, but not anymore, so I'm not going to maintain it. You can fork it and continue the work if you want. |\n| --- | --- |\n\nMulti-language plugin for [Hexo](https://github.com/hexojs/hexo). Helps you manage a Hexo page whose contents are written in different languages.\n\nBased in [`hexo-generator-basic-set`](https://github.com/zyzyz/hexo-generator-basic-set) and [`hexo-generator-i18n`](https://github.com/Jamling/hexo-generator-i18n).\n\n## Demo\n\nYou can see this plugin in use in [maldorne.org](https://maldorne.org), a Hexo blog which uses the `hexo-multilang` plugin with a modified version of the [Chic](https://github.com/Siricee/hexo-theme-Chic) theme. It has a language selector in the upper right corner, so you can see the blog changes **not only** the language of the theme, but the language of the contents, also.\n\n### How to test the plugin in an easy way\n\nThis plugin provides functions which can help you build a multilang theme. The fastest way to see what can be achieved would be using an already compatible theme, so you could compare code and include the functionalities you would need in your own page. I've modified a version of the [Chic Theme](https://github.com/Siricee/hexo-theme-Chic) to make it compatible with `hexo-multilang`, which you can found in [hexo-chic-theme-multilang](https://github.com/neverbot/hexo-theme-chic-multilang). Take a look to its installation instructions if you want to test it in a local Hexo Blog, so you can see if this is what you are looking for.\n\n## Installation\n\n``` bash\n$ npm install hexo-multilang\n```\n\nRemove any of these packages if they are installed:\n``` bash\n$ npm remove hexo-generator-archive hexo-generator-category hexo-generator-index hexo-generator-tag hexo-generator-basic-set hexo-generator-i18n\n```\n\nIn Hexo the list of plugins installed will be taken from the `package.json` file, and will be loaded and executed in the order which they are found in. Any change or update to this file, locally or in a continuous integration environment, might be able to set its contents in alphabetical order, potentially changing your expected results. As the generators (`archive`, `index`, `tag`, `category`) are called by the same name in every plugin, the last plugin which uses them will have precedence.\n\nSo, until Hexo has a better way of handling the loading and execution of plugins, my recommendation is to uninstall any other plugin which includes the same generators or helpers, like the four default ones (the `npm remove` you can see above these lines), or the plugins `hexo-multilang` is based on, like `hexo-generator-basic-set` and `hexo-generator-i18n`.\n\n## Config\n\n*_config.yml*\n``` yaml\nplugins:\n  hexo-multilang:\n    languages: [en, es]  \n\n    pagination-dir: page\n\n    index-generator:\n      per-page: 5\n      order-by: -date\n      index-dir: \n      default-lang: en\n\n    archive-generator:\n      per-page: 10\n      order-by: -date\n      archives-dir: archives\n      yearly: true\n      monthly: true\n      daily: false\n\n    category-generator:\n      per-page: 10\n      order-by: -date\n      categories-dir: categories\n      enable-index-page: true\n\n    tag-generator:\n      per-page: 5\n      order-by: -date\n      tags-dir: tags\n      enable-index-page: true\n```\n\n## Post creator modified\n\nWhen you create a new blog post, it will be created (based on the corresponding scaffold) in every language set in the `_config.yml` file. i.e: for a config with:\n``` yaml\nlanguage: [en, es]\npermalink: :language/:year/:month/:day/:title/\nnew_post_name: :language/:year/:month/:day/:title.md\n```\nthe creation of a new post will be like this:\n``` bash\n$ hexo new 'Something something'\nINFO  Posts created in: en, es\nINFO  Created: /\u003cyour path\u003e/source/_posts/es/1900/01/01/something-something.md\nINFO  Created: /\u003cyour path\u003e/source/_posts/en/1900/01/01/something-something.md\n```\n\n## Helpers included\n\n### url_for\n\nThis plugin overwrites the original hexo `url_for` helper with a new one. By default it would prepend the needed language in the url path:  `https://domain.com/some/thing/` would be `https://domain.com/\u003clang\u003e/some/thing/`.\nIf you need the original helper, it is saved as `__hexo_multilang_url_for`.\n\n``` html\n\u003ca href=\"\u003c%- url_for(post.path) %\u003e\"\u003e\u003c%= post.title %\u003e\u003c/a\u003e\n```\n\nIt also accepts a second parameter with options:\n``` js\nurl_for(path, { ignore : bool, language : string })\n```\nIf `ignore` is present and is `true`, the `url_for` helper will behave as the original Hexo helper. This is useful to use for assets or other urls which would not be multilanguage. When you use this plugin with an already installed template, you will have to add this parameter to the links in the `\u003chead\u003e` of the web, like css, js, etc.\n\n``` html\n\u003c% theme.stylesheets.forEach(url =\u003e { %\u003e\n\u003clink rel=\"stylesheet\" href=\"\u003c%- url_for(url, { ignore: true }) %\u003e\"\u003e\n\u003c% }); %\u003e\n```\n\nIf `language` is present and is one of the languages defined as an option in the plugin configuration, the language part of the url will be forced to be this value.\n\n## License\n\n[MIT](https://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneverbot%2Fhexo-multilang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneverbot%2Fhexo-multilang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneverbot%2Fhexo-multilang/lists"}