# MkDocs Site URLs
A MkDocs plugin that adds support for site-relative `site:` URLs.
Example:
| URL | site_url | resulting URL |
| --- | -------- | ------------- |
| `site:images/foo.png` | `https://example.com/` | `/images/foo.png` |
| `site:images/foo.png` | `https://example.com/bar/` | `/bar/images/foo.png` |
## Usage
1. Install the plugin from PyPI
```bash
pip install mkdocs-site-urls
```
2. Add the `site-urls` plugin to your `mkdocs.yml` plugins section:
```yaml
plugins:
- site-urls
```
There are no configuration options.
3. Start using site-relative URLs in your Markdown files by prefixing them with `site:`:
```markdown
[Link to another page](site:another-page/relative/to/the/site/root)
![Image](site:images/foo.png)
```
## How it works
The plugin hooks into the [`on_page_content` event](https://www.mkdocs.org/dev-guide/plugins/#on_page_content)
and replaces all URLs in `href` or `src` attributes in the rendered HTML with the corresponding site-relative URLs.
## License
This project is licensed under the MIT license, see the [LICENSE](https://github.com/OctoPrint/mkdocs-site-urls/blob/main/LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/OctoPrint/mkdocs-site-urls",
"name": "mkdocs-site-urls",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "mkdocs,plugin",
"author": "Gina H\u00e4u\u00dfge",
"author_email": "gina@octoprint.org",
"download_url": "https://files.pythonhosted.org/packages/09/2d/9eadb3d284faf03c74023c6467b032997836cb0d8e208b3c04d207530246/mkdocs-site-urls-0.1.0.tar.gz",
"platform": null,
"description": "# MkDocs Site URLs\n\nA MkDocs plugin that adds support for site-relative `site:` URLs.\n\nExample:\n\n| URL | site_url | resulting URL |\n| --- | -------- | ------------- |\n| `site:images/foo.png` | `https://example.com/` | `/images/foo.png` |\n| `site:images/foo.png` | `https://example.com/bar/` | `/bar/images/foo.png` |\n\n## Usage\n\n1. Install the plugin from PyPI\n ```bash\n pip install mkdocs-site-urls\n ```\n2. Add the `site-urls` plugin to your `mkdocs.yml` plugins section:\n ```yaml\n plugins:\n - site-urls\n ```\n There are no configuration options.\n3. Start using site-relative URLs in your Markdown files by prefixing them with `site:`:\n ```markdown\n [Link to another page](site:another-page/relative/to/the/site/root)\n\n ![Image](site:images/foo.png)\n ```\n\n## How it works\n\nThe plugin hooks into the [`on_page_content` event](https://www.mkdocs.org/dev-guide/plugins/#on_page_content)\nand replaces all URLs in `href` or `src` attributes in the rendered HTML with the corresponding site-relative URLs.\n\n## License\n\nThis project is licensed under the MIT license, see the [LICENSE](https://github.com/OctoPrint/mkdocs-site-urls/blob/main/LICENSE) file for details.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A MkDocs plugin that adds support for site-relative URLs",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/OctoPrint/mkdocs-site-urls",
"Source": "https://github.com/OctoPrint/mkdocs-site-urls"
},
"split_keywords": [
"mkdocs",
"plugin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "41c55dc54a8e5b6879cf3e0bb37829cdd2742a6dbb393121205f1affc15b0162",
"md5": "9915baef721d83144dcf65805f50fd09",
"sha256": "94b992f0cba992e7f4c244965e252abc8bcc21e14a88396075d5c72f2ce88277"
},
"downloads": -1,
"filename": "mkdocs_site_urls-0.1.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "9915baef721d83144dcf65805f50fd09",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.7",
"size": 3484,
"upload_time": "2023-07-28T13:43:04",
"upload_time_iso_8601": "2023-07-28T13:43:04.458760Z",
"url": "https://files.pythonhosted.org/packages/41/c5/5dc54a8e5b6879cf3e0bb37829cdd2742a6dbb393121205f1affc15b0162/mkdocs_site_urls-0.1.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "092d9eadb3d284faf03c74023c6467b032997836cb0d8e208b3c04d207530246",
"md5": "4076c624fdc4bd4313de828ca2625de7",
"sha256": "020245ac23b7ce65181821bbb3f7d7a46c62d4efa3ff3b1b6472faba903c032c"
},
"downloads": -1,
"filename": "mkdocs-site-urls-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "4076c624fdc4bd4313de828ca2625de7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 3157,
"upload_time": "2023-07-28T13:43:05",
"upload_time_iso_8601": "2023-07-28T13:43:05.582737Z",
"url": "https://files.pythonhosted.org/packages/09/2d/9eadb3d284faf03c74023c6467b032997836cb0d8e208b3c04d207530246/mkdocs-site-urls-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-28 13:43:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "OctoPrint",
"github_project": "mkdocs-site-urls",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mkdocs-site-urls"
}