@studyportals/fawkes 8.2.4-0 → 8.2.4-10
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/common/IPresenter.d.ts +1 -1
- package/dist/src/organisations/SearchIndexabilityManager.js +3 -2
- package/dist/src/organisations/policies/index.d.ts +2 -1
- package/dist/src/organisations/policies/index.js +2 -1
- package/dist/src/organisations/policies/our-picks/CountryAreaCity.d.ts +13 -0
- package/dist/src/organisations/policies/our-picks/CountryAreaCity.js +39 -0
- package/dist/src/organisations/policies/our-picks/CountryCity.d.ts +13 -0
- package/dist/src/organisations/policies/our-picks/CountryCity.js +37 -0
- package/dist/src/organisations/rules/OnlyFullLocationFiltersSelectedRule.js +1 -2
- package/dist/src/presenters/CityPresenter.d.ts +2 -3
- package/dist/src/presenters/CityPresenter.js +9 -6
- package/dist/src/sitemap-generator/ISearchApiClient.d.ts +2 -2
- package/dist/src/sitemap-generator/OrganisationsSitemapUrlGeneratorManager.js +4 -2
- package/package.json +3 -3
|
@@ -2,5 +2,5 @@ import { IFragment } from '../presenters/fragments/IFragment';
|
|
|
2
2
|
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
3
3
|
export interface IPresenter {
|
|
4
4
|
readonly filterKey: FilterKey;
|
|
5
|
-
getFragments(): IFragment[]
|
|
5
|
+
getFragments(): IFragment[];
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DependencyTypes } from '../enums/DependencyTypes';
|
|
2
|
-
import {
|
|
2
|
+
import { Area, AreaAttendance, Attendance, Continent, Country, CountryAttendance, Unfiltered, RankedArea, RankedAreaDiscipline, RankedAttendance, RankedAttendanceDiscipline, RankedContinent, RankedContinentAttendance, RankedCountry, RankedCountryAttendance, RankedCountryDiscipline, RankedDiscipline, RankedUnfiltered, CountryCity, CountryAreaCity } from '../organisations/policies';
|
|
3
3
|
export class SearchIndexabilityManager {
|
|
4
4
|
policies;
|
|
5
5
|
constructor(portalType, seoInfoBase, filterState, sortingState, applicationState) {
|
|
@@ -12,12 +12,13 @@ export class SearchIndexabilityManager {
|
|
|
12
12
|
portalType
|
|
13
13
|
};
|
|
14
14
|
this.policies = [
|
|
15
|
-
new City(dependencies),
|
|
16
15
|
new Area(dependencies),
|
|
17
16
|
new AreaAttendance(dependencies),
|
|
18
17
|
new Attendance(dependencies),
|
|
19
18
|
new Continent(dependencies),
|
|
20
19
|
new Country(dependencies),
|
|
20
|
+
new CountryCity(dependencies),
|
|
21
|
+
new CountryAreaCity(dependencies),
|
|
21
22
|
new CountryAttendance(dependencies),
|
|
22
23
|
new Unfiltered(dependencies),
|
|
23
24
|
new RankedArea(dependencies),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export * from './our-picks/City';
|
|
2
1
|
export * from './our-picks/Area';
|
|
3
2
|
export * from './our-picks/AreaAttendance';
|
|
4
3
|
export * from './our-picks/Attendance';
|
|
5
4
|
export * from './our-picks/Continent';
|
|
6
5
|
export * from './our-picks/Country';
|
|
6
|
+
export * from './our-picks/CountryCity';
|
|
7
|
+
export * from './our-picks/CountryAreaCity';
|
|
7
8
|
export * from './our-picks/CountryAttendance';
|
|
8
9
|
export * from './our-picks/Unfiltered';
|
|
9
10
|
export * from './ranked/RankedArea';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export * from './our-picks/City';
|
|
2
1
|
export * from './our-picks/Area';
|
|
3
2
|
export * from './our-picks/AreaAttendance';
|
|
4
3
|
export * from './our-picks/Attendance';
|
|
5
4
|
export * from './our-picks/Continent';
|
|
6
5
|
export * from './our-picks/Country';
|
|
6
|
+
export * from './our-picks/CountryCity';
|
|
7
|
+
export * from './our-picks/CountryAreaCity';
|
|
7
8
|
export * from './our-picks/CountryAttendance';
|
|
8
9
|
export * from './our-picks/Unfiltered';
|
|
9
10
|
export * from './ranked/RankedArea';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FilterCombinations } from '../../../enums/FilterCombinations';
|
|
2
|
+
import { SortingOptions } from '../../../enums/SortingOptions';
|
|
3
|
+
import { OrganisationsSeoIndexabilityPolicy } from '../../../organisations/policies/OrganisationsSeoIndexabilityPolicy';
|
|
4
|
+
import { SingleValueSelectedForFilterRule } from '../../../common/rules/SingleValueSelectedForFilterRule';
|
|
5
|
+
import { OnlyFiltersSelectedRule } from '../../../common/rules/OnlyFiltersSelectedRule';
|
|
6
|
+
export declare class CountryAreaCity extends OrganisationsSeoIndexabilityPolicy {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly description: string;
|
|
9
|
+
protected readonly sortingOption = SortingOptions.OUR_PICKS;
|
|
10
|
+
protected readonly baseRules: (SingleValueSelectedForFilterRule | OnlyFiltersSelectedRule)[];
|
|
11
|
+
protected generateUrls(): Promise<string[]>;
|
|
12
|
+
get filterCombination(): FilterCombinations;
|
|
13
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FilterCombinations } from '../../../enums/FilterCombinations';
|
|
2
|
+
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
3
|
+
import { SortingOptions } from '../../../enums/SortingOptions';
|
|
4
|
+
import { OrganisationsSeoIndexabilityPolicy } from '../../../organisations/policies/OrganisationsSeoIndexabilityPolicy';
|
|
5
|
+
import { SingleValueSelectedForFilterRule } from '../../../common/rules/SingleValueSelectedForFilterRule';
|
|
6
|
+
import { OnlyFiltersSelectedRule } from '../../../common/rules/OnlyFiltersSelectedRule';
|
|
7
|
+
import { CityPresenter } from '../../../presenters/CityPresenter';
|
|
8
|
+
export class CountryAreaCity extends OrganisationsSeoIndexabilityPolicy {
|
|
9
|
+
name = 'Country Area City Policy';
|
|
10
|
+
description = 'Controls indexing of pages filtered by geographic cities and areas, ensuring only SEO-valuable regional content with sufficient search volume is indexed.';
|
|
11
|
+
sortingOption = SortingOptions.OUR_PICKS;
|
|
12
|
+
baseRules = [
|
|
13
|
+
new SingleValueSelectedForFilterRule(FilterKey.CITY),
|
|
14
|
+
new SingleValueSelectedForFilterRule(FilterKey.COUNTRY),
|
|
15
|
+
new SingleValueSelectedForFilterRule(FilterKey.AREA),
|
|
16
|
+
new OnlyFiltersSelectedRule([FilterKey.CITY, FilterKey.COUNTRY, FilterKey.AREA])
|
|
17
|
+
];
|
|
18
|
+
async generateUrls() {
|
|
19
|
+
const cityFragments = await CityPresenter
|
|
20
|
+
.getInstance(this.dependencies.searchApiClient)
|
|
21
|
+
.getFragments();
|
|
22
|
+
const paths = [];
|
|
23
|
+
for (const city of cityFragments) {
|
|
24
|
+
const filterKeyValues = new Map([
|
|
25
|
+
[FilterKey.CITY, [city.id]],
|
|
26
|
+
[FilterKey.AREA, [city.areaId]],
|
|
27
|
+
[FilterKey.COUNTRY, [city.countryId]]
|
|
28
|
+
]);
|
|
29
|
+
const result = await this.checkRulesForSitemap(filterKeyValues);
|
|
30
|
+
if (result) {
|
|
31
|
+
paths.push(this.getPathWithSortingOption(city.path));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return paths;
|
|
35
|
+
}
|
|
36
|
+
get filterCombination() {
|
|
37
|
+
return FilterCombinations.CITY;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FilterCombinations } from '../../../enums/FilterCombinations';
|
|
2
|
+
import { SortingOptions } from '../../../enums/SortingOptions';
|
|
3
|
+
import { OrganisationsSeoIndexabilityPolicy } from '../../../organisations/policies/OrganisationsSeoIndexabilityPolicy';
|
|
4
|
+
import { SingleValueSelectedForFilterRule } from '../../../common/rules/SingleValueSelectedForFilterRule';
|
|
5
|
+
import { OnlyFiltersSelectedRule } from '../../../common/rules/OnlyFiltersSelectedRule';
|
|
6
|
+
export declare class CountryCity extends OrganisationsSeoIndexabilityPolicy {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly description: string;
|
|
9
|
+
protected readonly sortingOption = SortingOptions.OUR_PICKS;
|
|
10
|
+
protected readonly baseRules: (SingleValueSelectedForFilterRule | OnlyFiltersSelectedRule)[];
|
|
11
|
+
protected generateUrls(): Promise<string[]>;
|
|
12
|
+
get filterCombination(): FilterCombinations;
|
|
13
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FilterCombinations } from '../../../enums/FilterCombinations';
|
|
2
|
+
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
3
|
+
import { SortingOptions } from '../../../enums/SortingOptions';
|
|
4
|
+
import { OrganisationsSeoIndexabilityPolicy } from '../../../organisations/policies/OrganisationsSeoIndexabilityPolicy';
|
|
5
|
+
import { CityPresenter } from '../../../presenters/CityPresenter';
|
|
6
|
+
import { SingleValueSelectedForFilterRule } from '../../../common/rules/SingleValueSelectedForFilterRule';
|
|
7
|
+
import { OnlyFiltersSelectedRule } from '../../../common/rules/OnlyFiltersSelectedRule';
|
|
8
|
+
export class CountryCity extends OrganisationsSeoIndexabilityPolicy {
|
|
9
|
+
name = 'Country City Policy';
|
|
10
|
+
description = 'Controls indexing of pages filtered by geographic cities, ensuring only SEO-valuable regional content with sufficient search volume is indexed.';
|
|
11
|
+
sortingOption = SortingOptions.OUR_PICKS;
|
|
12
|
+
baseRules = [
|
|
13
|
+
new SingleValueSelectedForFilterRule(FilterKey.CITY),
|
|
14
|
+
new SingleValueSelectedForFilterRule(FilterKey.COUNTRY),
|
|
15
|
+
new OnlyFiltersSelectedRule([FilterKey.CITY, FilterKey.COUNTRY])
|
|
16
|
+
];
|
|
17
|
+
async generateUrls() {
|
|
18
|
+
const cityFragments = await CityPresenter
|
|
19
|
+
.getInstance(this.dependencies.searchApiClient)
|
|
20
|
+
.getFragments();
|
|
21
|
+
const paths = [];
|
|
22
|
+
for (const city of cityFragments) {
|
|
23
|
+
const filterKeyValues = new Map([
|
|
24
|
+
[FilterKey.CITY, [city.id]],
|
|
25
|
+
[FilterKey.COUNTRY, [city.countryId]]
|
|
26
|
+
]);
|
|
27
|
+
const result = await this.checkRulesForSitemap(filterKeyValues);
|
|
28
|
+
if (result) {
|
|
29
|
+
paths.push(this.getPathWithSortingOption(city.path));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return paths;
|
|
33
|
+
}
|
|
34
|
+
get filterCombination() {
|
|
35
|
+
return FilterCombinations.CITY;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -8,8 +8,7 @@ export class OnlyFullLocationFiltersSelectedRule {
|
|
|
8
8
|
return await this.isEligible(dependencies);
|
|
9
9
|
}
|
|
10
10
|
forSitemapGenerator() {
|
|
11
|
-
|
|
12
|
-
return Promise.resolve(false);
|
|
11
|
+
return Promise.resolve(true);
|
|
13
12
|
}
|
|
14
13
|
getDescription() {
|
|
15
14
|
return `Only city, country and area (if US, UK or AU) filters are selected`;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
2
2
|
import { ICityFragment } from './fragments/ICityFragment';
|
|
3
|
-
import {
|
|
4
|
-
export declare class CityPresenter
|
|
3
|
+
import { ISearchApiClient } from '../../sitemap-generator-seo';
|
|
4
|
+
export declare class CityPresenter {
|
|
5
5
|
readonly filterKey: FilterKey;
|
|
6
6
|
private searchApiClient;
|
|
7
7
|
private static instance;
|
|
8
|
-
private resultSize;
|
|
9
8
|
private constructor();
|
|
10
9
|
private fragmentsPromise;
|
|
11
10
|
static getInstance(searchApiClient: ISearchApiClient): CityPresenter;
|
|
@@ -6,7 +6,6 @@ export class CityPresenter {
|
|
|
6
6
|
filterKey = FilterKey.CITY;
|
|
7
7
|
searchApiClient;
|
|
8
8
|
static instance;
|
|
9
|
-
resultSize = 600;
|
|
10
9
|
constructor(searchApiClient) {
|
|
11
10
|
this.searchApiClient = searchApiClient;
|
|
12
11
|
}
|
|
@@ -25,24 +24,28 @@ export class CityPresenter {
|
|
|
25
24
|
}
|
|
26
25
|
async fetchCities() {
|
|
27
26
|
try {
|
|
27
|
+
if (!this.searchApiClient.getCities) {
|
|
28
|
+
console.error('searchApiClient.getCities is not found');
|
|
29
|
+
throw new Error('searchApiClient.getCities is not found');
|
|
30
|
+
}
|
|
28
31
|
const data = await this.searchApiClient.getCities();
|
|
29
32
|
const cityFragments = data.map(city => {
|
|
30
33
|
const country = countriesExtendedAll.find(item => item.iso?.toLowerCase() === city.countryIsoCode?.toLowerCase());
|
|
31
34
|
let cityPath = ``;
|
|
32
35
|
const countryPath = countryGetIsoCodePath(country?.iso || '');
|
|
33
36
|
if (city.areaId === null || city.areaId === undefined) {
|
|
34
|
-
cityPath += countryPath
|
|
37
|
+
cityPath += `${countryPath}/`;
|
|
35
38
|
}
|
|
36
|
-
|
|
39
|
+
else {
|
|
37
40
|
const area = areaGetPath(city.areaId?.toString() || '');
|
|
38
41
|
if (area && area !== '') {
|
|
39
|
-
cityPath +=
|
|
42
|
+
cityPath += `${area}/`;
|
|
40
43
|
}
|
|
41
44
|
else {
|
|
42
|
-
cityPath += countryPath
|
|
45
|
+
cityPath += `${countryPath}/`;
|
|
43
46
|
}
|
|
44
47
|
}
|
|
45
|
-
cityPath +=
|
|
48
|
+
cityPath += `${city.virtualPath}`;
|
|
46
49
|
return {
|
|
47
50
|
id: city.id.toString(),
|
|
48
51
|
path: cityPath,
|
|
@@ -2,13 +2,13 @@ import { FilterKeyValuesMap } from '../common/FilterKeyValuesMap';
|
|
|
2
2
|
export interface ISearchApiClient {
|
|
3
3
|
getOrganisationIds(): Promise<number[]>;
|
|
4
4
|
getCityIds?(): Promise<number[]>;
|
|
5
|
-
getCities(): Promise<{
|
|
5
|
+
getCities?(): Promise<{
|
|
6
6
|
id: number;
|
|
7
7
|
name: string;
|
|
8
8
|
virtualPath: string;
|
|
9
9
|
areaId: number | null;
|
|
10
10
|
countryIsoCode: string;
|
|
11
11
|
}[]>;
|
|
12
|
-
getProgrammeCount(filterKeyValues: FilterKeyValuesMap): Promise<number>;
|
|
12
|
+
getProgrammeCount?(filterKeyValues: FilterKeyValuesMap): Promise<number>;
|
|
13
13
|
getCount(filterKeyValues: FilterKeyValuesMap): Promise<number>;
|
|
14
14
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { DependencyTypes } from '../enums/DependencyTypes';
|
|
2
2
|
import { BaseSitemapUrlGeneratorManager } from './BaseSitemapUrlGeneratorManager';
|
|
3
|
-
import {
|
|
3
|
+
import { Area, AreaAttendance, Attendance, Continent, Country, CountryCity, CountryAttendance, RankedArea, RankedAreaDiscipline, RankedAttendance, RankedAttendanceDiscipline, RankedContinent, RankedContinentAttendance, RankedCountry, RankedCountryAttendance, RankedCountryDiscipline, RankedDiscipline, RankedUnfiltered, Unfiltered } from '../organisations/policies';
|
|
4
4
|
import { AreaPresenter } from '../presenters/AreaPresenter';
|
|
5
5
|
import { AttendancePresenter } from '../presenters/AttendancePresenter';
|
|
6
6
|
import { ContinentPresenter } from '../presenters/ContinentPresenter';
|
|
7
7
|
import { CountryPresenter } from '../presenters/CountryPresenter';
|
|
8
8
|
import { DisciplinePresenter } from '../presenters/DisciplinePresenter';
|
|
9
9
|
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
10
|
+
import { CountryAreaCity } from '../organisations/policies/our-picks/CountryAreaCity';
|
|
10
11
|
export class OrganisationsSitemapUrlGeneratorManager extends BaseSitemapUrlGeneratorManager {
|
|
11
12
|
portalType;
|
|
12
13
|
policies;
|
|
@@ -22,7 +23,8 @@ export class OrganisationsSitemapUrlGeneratorManager extends BaseSitemapUrlGener
|
|
|
22
23
|
rankingApiClient
|
|
23
24
|
};
|
|
24
25
|
this.policies = [
|
|
25
|
-
new
|
|
26
|
+
new CountryCity(dependencies),
|
|
27
|
+
new CountryAreaCity(dependencies),
|
|
26
28
|
new Area(dependencies),
|
|
27
29
|
new AreaAttendance(dependencies),
|
|
28
30
|
new Attendance(dependencies),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studyportals/fawkes",
|
|
3
|
-
"version": "8.2.4-
|
|
3
|
+
"version": "8.2.4-10",
|
|
4
4
|
"description": "A package to centralize SEO related logic for SBLP and Sitemap Generator.",
|
|
5
5
|
"files": [
|
|
6
6
|
"./dist"
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"@rollup/rollup-linux-x64-gnu": "4.24.0"
|
|
100
100
|
},
|
|
101
101
|
"engines": {
|
|
102
|
-
"node": ">=18 <=
|
|
103
|
-
"npm": ">=8 <=
|
|
102
|
+
"node": ">=18 <=24",
|
|
103
|
+
"npm": ">=8 <=11"
|
|
104
104
|
}
|
|
105
105
|
}
|