Skip to content

Commit 6208554

Browse files
committed
Filter node urls
1 parent eaa29e7 commit 6208554

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.UrlInspectionTool/App_Plugins/UmbracoCms.Integrations/SEO/GoogleSearchConsole/URLInspectionTool/js/url-inspection-tool.controller.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
vm.inspectionResult = {};
88

99
// build default url inspection object
10+
var nodeUrls = getUrls();
1011
vm.inspectionObj = {
11-
urls: editorState.current.urls,
12-
inspectionUrl: editorState.current.urls[0].text,
12+
urls: nodeUrls,
13+
inspectionUrl: nodeUrls[0],
1314
siteUrl: window.location.origin,
1415
languageCode: editorState.current.urls[0].culture,
1516
multipleUrls: editorState.current.urls.length > 1,
@@ -127,6 +128,22 @@
127128
var regExp = new RegExp('^(?:[a-z]+:)?//', 'i');
128129
return !regExp.test(url);
129130
}
131+
132+
function getUrls() {
133+
var arr = [];
134+
135+
for (var i = 0; i < editorState.current.urls.length; i++) {
136+
var url = isRelativeUrl(editorState.current.urls[i].text)
137+
? `${window.location.origin}${editorState.current.urls[i].text}`
138+
: editorState.current.urls[i].text;
139+
140+
if (arr.indexOf(url) === -1) {
141+
arr.push(url);
142+
}
143+
}
144+
145+
return arr;
146+
}
130147
}
131148

132149
angular.module("umbraco")

src/Umbraco.Cms.Integrations.SEO.GoogleSearchConsole.UrlInspectionTool/App_Plugins/UmbracoCms.Integrations/SEO/GoogleSearchConsole/URLInspectionTool/urlInspection.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ <h5>Inspection URL</h5>
4545
no-dirty-check ng-disabled="!vm.inspectionObj.enabled" />
4646
<select ng-if="vm.inspectionObj.multipleUrls" ng-model="vm.inspectionObj.inspectionUrl" ng-change="vm.onChangeInspectionUrl()"
4747
no-dirty-check class="w-100">
48-
<option ng-repeat="url in vm.inspectionObj.urls" value="{{ url.text }}">{{ url.text }}</option>
48+
<option ng-repeat="url in vm.inspectionObj.urls" value="{{ url }}">{{ url }}</option>
4949
</select>
5050
</div>
5151
<div class="ml3 w25r">

0 commit comments

Comments
 (0)