@studyportals/fawkes 8.2.4-11 → 8.2.4-13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/organisations/policies/our-picks/CountryAreaCity.js +11 -2
- package/dist/src/organisations/policies/our-picks/CountryCity.js +6 -1
- package/dist/src/presenters/CityPresenter.d.ts +1 -0
- package/dist/src/presenters/CityPresenter.js +16 -29
- package/dist/src/presenters/fragments/ICityFragment.d.ts +1 -1
- package/dist/src/sitemap-generator/ICity.d.ts +7 -0
- package/dist/src/sitemap-generator/ICity.js +1 -0
- package/package.json +1 -1
|
@@ -20,10 +20,17 @@ export class CountryAreaCity extends OrganisationsSeoIndexabilityPolicy {
|
|
|
20
20
|
.getInstance(this.dependencies.searchApiClient)
|
|
21
21
|
.getFragments();
|
|
22
22
|
const paths = [];
|
|
23
|
-
|
|
23
|
+
const filteredFragmentsForCountryAreaCity = cityFragments.filter(city => city.areaId !== null && city.areaId !== undefined);
|
|
24
|
+
console.warn(`Filtered down to ${filteredFragmentsForCountryAreaCity.length} city fragments for CountryAreaCity policy.`);
|
|
25
|
+
console.warn('Filtered city fragments for CountryAreaCity policy:', JSON.stringify(filteredFragmentsForCountryAreaCity));
|
|
26
|
+
for (const city of filteredFragmentsForCountryAreaCity) {
|
|
27
|
+
const areaId = city.areaId?.toString() || '';
|
|
28
|
+
if (areaId === '') {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
24
31
|
const filterKeyValues = new Map([
|
|
25
32
|
[FilterKey.CITY, [city.id]],
|
|
26
|
-
[FilterKey.AREA, [
|
|
33
|
+
[FilterKey.AREA, [areaId]],
|
|
27
34
|
[FilterKey.COUNTRY, [city.countryId]]
|
|
28
35
|
]);
|
|
29
36
|
const result = await this.checkRulesForSitemap(filterKeyValues);
|
|
@@ -31,6 +38,8 @@ export class CountryAreaCity extends OrganisationsSeoIndexabilityPolicy {
|
|
|
31
38
|
paths.push(this.getPathWithSortingOption(city.path));
|
|
32
39
|
}
|
|
33
40
|
}
|
|
41
|
+
console.warn(`Generated ${paths.length} URLs for CountryAreaCity policy.`);
|
|
42
|
+
console.warn('Generated URLs:', JSON.stringify(paths));
|
|
34
43
|
return paths;
|
|
35
44
|
}
|
|
36
45
|
get filterCombination() {
|
|
@@ -19,7 +19,10 @@ export class CountryCity extends OrganisationsSeoIndexabilityPolicy {
|
|
|
19
19
|
.getInstance(this.dependencies.searchApiClient)
|
|
20
20
|
.getFragments();
|
|
21
21
|
const paths = [];
|
|
22
|
-
|
|
22
|
+
const filteredFragmentsForCountryCity = cityFragments.filter(city => city.areaId === null || city.areaId === undefined);
|
|
23
|
+
console.warn(`Filtered down to ${filteredFragmentsForCountryCity.length} city fragments for CountryCity policy.`);
|
|
24
|
+
console.warn('Filtered city fragments for CountryCity policy:', JSON.stringify(filteredFragmentsForCountryCity));
|
|
25
|
+
for (const city of filteredFragmentsForCountryCity) {
|
|
23
26
|
const filterKeyValues = new Map([
|
|
24
27
|
[FilterKey.CITY, [city.id]],
|
|
25
28
|
[FilterKey.COUNTRY, [city.countryId]]
|
|
@@ -29,6 +32,8 @@ export class CountryCity extends OrganisationsSeoIndexabilityPolicy {
|
|
|
29
32
|
paths.push(this.getPathWithSortingOption(city.path));
|
|
30
33
|
}
|
|
31
34
|
}
|
|
35
|
+
console.warn(`Generated ${paths.length} URLs for CountryCity policy.`);
|
|
36
|
+
console.warn('Generated URLs:', JSON.stringify(paths));
|
|
32
37
|
return paths;
|
|
33
38
|
}
|
|
34
39
|
get filterCombination() {
|
|
@@ -28,35 +28,8 @@ export class CityPresenter {
|
|
|
28
28
|
console.error('searchApiClient.getCities is not found');
|
|
29
29
|
throw new Error('searchApiClient.getCities is not found');
|
|
30
30
|
}
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
console.warn('cities', JSON.stringify(data));
|
|
34
|
-
const cityFragments = data.map(city => {
|
|
35
|
-
const country = countriesExtendedAll.find(item => item.iso?.toLowerCase() === city.countryIsoCode?.toLowerCase());
|
|
36
|
-
let cityPath = ``;
|
|
37
|
-
const countryPath = countryGetIsoCodePath(country?.iso || '');
|
|
38
|
-
if (city.areaId === null || city.areaId === undefined) {
|
|
39
|
-
cityPath += `${countryPath}/`;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
const area = areaGetPath(city.areaId?.toString() || '');
|
|
43
|
-
if (area && area !== '') {
|
|
44
|
-
cityPath += `${area}/`;
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
cityPath += `${countryPath}/`;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
cityPath += `${city.virtualPath}`;
|
|
51
|
-
return {
|
|
52
|
-
id: city.id.toString(),
|
|
53
|
-
path: cityPath,
|
|
54
|
-
areaId: city.areaId?.toString(),
|
|
55
|
-
countryId: country ? country.id.toString() : '',
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
console.warn(`Processed ${cityFragments.length} city fragments.`);
|
|
59
|
-
console.warn('cityFragments', JSON.stringify(cityFragments));
|
|
31
|
+
const cities = await this.searchApiClient.getCities();
|
|
32
|
+
const cityFragments = cities.map(city => this.processCity(city));
|
|
60
33
|
return cityFragments;
|
|
61
34
|
}
|
|
62
35
|
catch (error) {
|
|
@@ -64,4 +37,18 @@ export class CityPresenter {
|
|
|
64
37
|
throw error;
|
|
65
38
|
}
|
|
66
39
|
}
|
|
40
|
+
processCity(city) {
|
|
41
|
+
const country = countriesExtendedAll.find(item => item.iso?.toLowerCase() === city.countryIsoCode?.toLowerCase());
|
|
42
|
+
const countryPath = countryGetIsoCodePath(country?.iso || '');
|
|
43
|
+
const areaPath = city.areaId != null ? areaGetPath(city.areaId.toString()) : '';
|
|
44
|
+
const useAreaPath = areaPath && areaPath.trim() !== '';
|
|
45
|
+
// AreaPath do also includes country, for that reason, we do not need to add countryPath if area exists
|
|
46
|
+
const cityPath = `${useAreaPath ? areaPath : countryPath}/${city.virtualPath}`;
|
|
47
|
+
return {
|
|
48
|
+
id: city.id.toString(),
|
|
49
|
+
path: cityPath,
|
|
50
|
+
areaId: useAreaPath ? city.areaId?.toString() : null,
|
|
51
|
+
countryId: country ? country.id.toString() : '',
|
|
52
|
+
};
|
|
53
|
+
}
|
|
67
54
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|