Skip to content

Commit 35de30a

Browse files
committed
fix: do not exclude the resource-new-path
the `resource/new`-path also shouldn’t be indexed, just like any other resource-path
1 parent 31acdd5 commit 35de30a

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

ckanext/switzerland/helpers.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -792,14 +792,9 @@ def _is_noindex_admin_path(path):
792792

793793

794794
def _is_resource_path(path):
795-
"""True for /dataset/<id>/resource/<resource_id> HTML pages."""
795+
"""True for all /dataset/<id>/resource/... HTML pages."""
796796
if not path:
797797
return False
798798
parts = [p for p in path.strip("/").split("/") if p]
799-
# dataset / <id> / resource / <resource_id> [/optional subpath]
800-
return (
801-
len(parts) >= 4
802-
and parts[0] == "dataset"
803-
and parts[2] == "resource"
804-
and parts[3] != "new"
805-
)
799+
# dataset / <id> / resource / <resource_id-or-"new"> [/optional subpath]
800+
return len(parts) >= 4 and parts[0] == "dataset" and parts[2] == "resource"

ckanext/switzerland/tests/test_helpers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ def __init__(self, endpoint, path="/", args=None):
144144
None,
145145
NOINDEX,
146146
),
147+
# The "add new resource" form is a resource path too, so it's noindex as well
148+
("resource.new", "/dataset/bike-and-car-parking/resource/new", None, NOINDEX),
147149
("user.read", "/user/admin", None, NOINDEX),
148150
],
149151
)

0 commit comments

Comments
 (0)