From 9fb2cb4a1aa944c91f5999c0fe7df98169828220 Mon Sep 17 00:00:00 2001 From: Yuriy Selivanov Date: Fri, 6 Feb 2026 12:22:12 +0300 Subject: [PATCH 1/4] docs: move path-in-domain syntax under $path modifier docs: move path-in-domain syntax under $path modifier Path-in-domain is now a subsection of $path modifier instead of a separate cosmetic rules section, reflecting that it's an alternative syntax converted to $path internally. --- .../ad-filtering/create-own-filters.md | 101 +++++------------- 1 file changed, 26 insertions(+), 75 deletions(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 151389026c9..2fef94f34ec 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -3370,7 +3370,6 @@ The rules described in this section are created specifically for this purpose. | --- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | [Element hiding](#cosmetic-elemhide-rules) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | [CSS rules](#cosmetic-css-rules) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | -| [Path-in-domain syntax](#cosmetic-path-in-domain) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | | [Extended CSS](#extended-css-selectors) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | | [HTML filtering](#html-filtering-rules) | ✅ | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ | | [JavaScript](#javascript-rules) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | @@ -3542,72 +3541,6 @@ example.org#@#body{remove:true;} ::: -### Path-in-domain syntax {#cosmetic-path-in-domain} - -AdGuard supports a simplified syntax for cosmetic rules that need to be applied only on specific paths of a website. Instead of using the `$path` modifier, you can specify the path directly in the domain part of the rule. - -**Syntax** - -```text -domain.com/path##selector -``` - -This is equivalent to: - -```text -[$path=/path]domain.com##selector -``` - -**Examples** - -- `example.org/checkout##.promo-banner` — hides `.promo-banner` elements only on checkout pages -- `news.site.com/article##.sidebar-ad` — hides sidebar ads only on article pages - -**Multiple domains** - -Path-in-domain syntax works with multiple domains: - -- `domain1.com,example.org/path##.banner` — applies to all pages on `domain1.com` and only `/path` pages on `example.org` - -**Regex domains** - -Path-in-domain syntax is also supported for regex domains: - -- `/example\.org\/article\d+/##.ad` — hides ads on article pages with numeric IDs - -**All cosmetic rule types** - -Path-in-domain syntax works with all types of cosmetic rules: - -```adblock -! Element hiding -example.org/path##.banner - -! Element hiding exception -example.org/path#@#.banner - -! CSS injection -example.org/path#$#.banner { display: block !important; } - -! HTML filtering -example.org/path$$script[src*="ads"] - -! HTML filtering exception -example.org/path$@$script[src*="ads"] - -! JavaScript rules -example.org/path#%#//scriptlet('abort-on-property-read', 'ads') - -! JavaScript exception -example.org/path#@%#//scriptlet('abort-on-property-read', 'ads') -``` - -:::info Compatibility - -Path-in-domain syntax has been introduced in [CoreLibs] v1.21. - -::: - ### Extended CSS selectors {#extended-css-selectors} - [Limitations](#extended-css-limitations) @@ -4881,14 +4814,6 @@ Such rules with `$domain` modifier are supported by AdGuard for Windows, AdGuard `$path` modifier limits the rule application area to specific locations or pages on websites. -:::tip Alternative syntax - -For cosmetic rules, you can use a simplified [path-in-domain syntax](#cosmetic-path-in-domain) instead of the `$path` modifier: - -- `example.org/path##.banner` instead of `[$path=/path]example.org##.banner` - -::: - **Syntax** ```text @@ -4914,6 +4839,32 @@ If `pattern` is not set for `$path`, rule will apply only on the main page of we - `[$domain=example.com,path=/page.html]##.textad` hides a `div` with the class `textad` at `page.html` of `example.com` and all subdomains but not at `another_page.html` - `[$path=/\\/(sub1|sub2)\\/page\\.html/]##.textad` hides a `div` with the class `textad` at both `/sub1/page.html` and `/sub2/page.html` of any domain (please note the [escaped special characters](#non-basic-rules-modifiers-syntax)) +#### Path-in-domain syntax {#path-in-domain-syntax} + +For cosmetic rules, you can use a simplified path-in-domain syntax by specifying the path directly in the domain part of the rule instead of using the `$path` modifier. + +**Syntax** + +```text + rule = [targets] "##" selector "{" style "}" +targets = [target0, target1[, ...[, targetN]]] + target = domain [path] +``` + +**Examples:** + +- `example.org/checkout##.promo-banner` — hides `.promo-banner` elements only on checkout pages +- `news.site.com/article##.sidebar-ad` — hides sidebar ads only on article pages +- `domain1.com,example.org/path##.banner` — applies to all pages on `domain1.com` and only `/path` pages on `example.org` +- `/example\.org\/article\d+/##.ad` — hides ads on article pages with numeric IDs + +Path-in-domain syntax works with all types of cosmetic rules (`##`, `#@#`, `#$#`, `$$`, `$@$`, `#%#`, `#@%#`) + +:::info Compatibility + +Path-in-domain syntax has been introduced in [CoreLibs] v1.21. +::: + #### `$path` modifier limitations {#non-basic-path-modifier-limitations} :::caution Limitations From 9cf5daa50981c0516d16e2250bb274c3d545c870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AE=D1=80=D0=B8=D0=B9?= <58909952+SelYui@users.noreply.github.com> Date: Fri, 6 Feb 2026 12:31:56 +0300 Subject: [PATCH 2/4] Update docs/general/ad-filtering/create-own-filters.md Co-authored-by: windsurf-bot[bot] <189301087+windsurf-bot[bot]@users.noreply.github.com> --- docs/general/ad-filtering/create-own-filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 2fef94f34ec..9a18db686d6 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -4846,7 +4846,7 @@ For cosmetic rules, you can use a simplified path-in-domain syntax by specifying **Syntax** ```text - rule = [targets] "##" selector "{" style "}" + rule = [targets] "##" selector targets = [target0, target1[, ...[, targetN]]] target = domain [path] ``` From afcee4490c999e118796c2425904c8e8b7492846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AE=D1=80=D0=B8=D0=B9?= <58909952+SelYui@users.noreply.github.com> Date: Fri, 6 Feb 2026 13:25:40 +0300 Subject: [PATCH 3/4] Update docs/general/ad-filtering/create-own-filters.md Co-authored-by: Helen <58733007+el-termikael@users.noreply.github.com> --- docs/general/ad-filtering/create-own-filters.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 9a18db686d6..3accf2e266f 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -4863,6 +4863,7 @@ Path-in-domain syntax works with all types of cosmetic rules (`##`, `#@#`, `#$#` :::info Compatibility Path-in-domain syntax has been introduced in [CoreLibs] v1.21. + ::: #### `$path` modifier limitations {#non-basic-path-modifier-limitations} From 992d1288aa4e4d1f3be1865d342252d29468463a Mon Sep 17 00:00:00 2001 From: Yuriy Selivanov Date: Fri, 6 Feb 2026 14:25:02 +0300 Subject: [PATCH 4/4] fix corelibs version --- docs/general/ad-filtering/create-own-filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/ad-filtering/create-own-filters.md b/docs/general/ad-filtering/create-own-filters.md index 3accf2e266f..0fe2ecac587 100644 --- a/docs/general/ad-filtering/create-own-filters.md +++ b/docs/general/ad-filtering/create-own-filters.md @@ -4862,7 +4862,7 @@ Path-in-domain syntax works with all types of cosmetic rules (`##`, `#@#`, `#$#` :::info Compatibility -Path-in-domain syntax has been introduced in [CoreLibs] v1.21. +Path-in-domain syntax has been introduced in [CoreLibs] v1.20. :::