diff --git a/CHANGELOG.md b/CHANGELOG.md index 0469d8d..8feb84d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ ## Unreleased +* Added `data-rosey-ignore` attribute to ignore hrefs when rewriting pages. + * See [Docs > URLS](https://rosey.app/docs/urls/) for more information. + ## v2.2.1 (August 28, 2024) * Ensures the JSON output of the check command is sorted to avoid changes in git between runs diff --git a/docs/content/docs/urls.md b/docs/content/docs/urls.md index 596c4e5..2417b80 100644 --- a/docs/content/docs/urls.md +++ b/docs/content/docs/urls.md @@ -1,15 +1,28 @@ --- -title: "Translated URLs" -nav_title: "Translated URLs" +title: "Managing URLs" +nav_title: "Managing URLs" nav_section: Workflow weight: 6 --- -Rosey URL locale files can contain translated URLs for your website in a given language. +Rosey provides some options for managing URLs. +Rosey can ignore some URLs altogether, and Rosey URL locale files can contain translated URLs for your website in a given language. If you just want to move one language to the root of the site, e.g. serve `/en/index.html` at `index.html` instead, see the [Default language at root](/docs/build/#default-language-at-root) option for Rosey's build step. +## Telling Rosey to ignore URLs + +If you have a URL on a page that you do not want Rosey to rewrite, you can add the `data-rosey-ignore` attribute to it. + +```html + Posts + + Contact +``` + +When built to a page in an `fr` locale, the first tag would link to `/fr/posts/`, while the tag with `data-rosey-ignore` would remain pointing at `/contact/`. + ## Creating translated URL locale files Creating URL locale files is not a step performed by Rosey. This part of the translation workflow is left open ended, usually integrating into an existing translation workflow for a company, or being programmatically created by transforming the input URLs. diff --git a/rosey/features/build/rosey-build-links.feature b/rosey/features/build/rosey-build-links.feature index a08e6b9..873c6ff 100644 --- a/rosey/features/build/rosey-build-links.feature +++ b/rosey/features/build/rosey-build-links.feature @@ -74,3 +74,29 @@ Feature: Rosey Links Then I should see a selector 'h2>a' in "dist/translated_site/blank/index.html" with the attributes: | href | /blank/hello | | innerText | Hello | + + + Scenario: Rosey can ignore links + Given I have a "dist/site/index.html" file with the content: + """ + +
+