@nuxtseo/pro-indexing 0.0.0-stage → 0.1.5
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/README.md +249 -2
- package/app/app.config.ts +14 -0
- package/app/components/IndexingCapabilityGate.vue +20 -0
- package/app/components/IndexingCohortList.vue +130 -0
- package/app/components/IndexingCoverageTrend.vue +145 -0
- package/app/components/IndexingCrawlPipeline.vue +211 -0
- package/app/components/IndexingDiagnosisPanel.vue +266 -0
- package/app/components/IndexingPortfolioChanges.vue +320 -0
- package/app/components/IndexingPortfolioIssues.vue +202 -0
- package/app/components/IndexingPortfolioOverview.vue +200 -0
- package/app/components/IndexingSiteIssues.vue +123 -0
- package/app/components/IndexingUrlsTable.vue +1084 -0
- package/app/components/IndexingUrlsTableShell.vue +237 -0
- package/app/composables/useIndexingSource.ts +27 -0
- package/app/composables/useProIndexingConfig.ts +10 -0
- package/app/composables/useProIndexingCopy.ts +10 -0
- package/app/composables/useProIndexingRoute.ts +23 -0
- package/nuxt.config.ts +33 -0
- package/package.json +67 -3
- package/shared/changes.ts +124 -0
- package/shared/config.ts +36 -0
- package/shared/copy.ts +306 -0
- package/shared/coverage-trend.ts +72 -0
- package/shared/issue-display.ts +77 -0
- package/shared/portfolio-overview.ts +120 -0
- package/shared/portfolio.ts +79 -0
- package/shared/routes.ts +63 -0
- package/shared/source.ts +153 -0
- package/shared/urls-query.ts +45 -0
package/shared/copy.ts
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
// The words the indexing sections render. COPY.md (Indexing section assets)
|
|
2
|
+
// owns each default; change it there first. A site rewords any key through
|
|
3
|
+
// app.config `proIndexing.copy`. Unset keys keep these defaults. Placeholders
|
|
4
|
+
// in braces, such as `{site}`, are filled by the component.
|
|
5
|
+
|
|
6
|
+
const DEFAULTS = {
|
|
7
|
+
common: {
|
|
8
|
+
failedTitle: 'Indexing data failed to load',
|
|
9
|
+
failedOne: '{site} could not be loaded. Try the indexing request again.',
|
|
10
|
+
failedMany: '{count} Sites could not be loaded. Try the indexing requests again.',
|
|
11
|
+
excludesOne: 'Excludes 1 Site that failed to load',
|
|
12
|
+
excludesMany: 'Excludes {count} Sites that failed to load',
|
|
13
|
+
retry: 'Retry',
|
|
14
|
+
collectingTitle: 'Collecting indexing data',
|
|
15
|
+
collectingBody: 'Indexing coverage appears after Search Console reports the first URL.',
|
|
16
|
+
fixIssues: 'Fix issues',
|
|
17
|
+
fixIssuesLabel: 'Fix issues: {issue} on {site}',
|
|
18
|
+
},
|
|
19
|
+
overview: {
|
|
20
|
+
indexedTitle: 'Indexed',
|
|
21
|
+
indexedTooltip: 'Share of submitted URLs that Google has indexed.',
|
|
22
|
+
notIndexedTitle: 'Not indexed',
|
|
23
|
+
notIndexedTooltip: 'Submitted URLs Google has not indexed.',
|
|
24
|
+
crawlErrorsTitle: 'Crawl errors',
|
|
25
|
+
crawlErrorsTooltip: 'URLs Google reports as not found, soft 404, or server errors. Sitemap availability and sitemap-page conflicts are shown separately.',
|
|
26
|
+
sitemapProblemsTitle: 'Sitemap problems',
|
|
27
|
+
sitemapProblemsTooltip: 'Sites with a Sitemap that is unreachable or has errors.',
|
|
28
|
+
sitemapProblemsFailedTooltip: 'The Sitemap status could not be read.',
|
|
29
|
+
sitemapProblemsFailed: 'Failed to load',
|
|
30
|
+
stackTitle: 'Not indexed URLs by Site',
|
|
31
|
+
trendSuffix: ' points',
|
|
32
|
+
},
|
|
33
|
+
siteIssues: {
|
|
34
|
+
tableLabel: 'Indexing issues for {site}',
|
|
35
|
+
issue: 'Issue',
|
|
36
|
+
count: 'Count',
|
|
37
|
+
action: 'Action',
|
|
38
|
+
failedBody: 'Google indexing data could not be loaded for {site}.',
|
|
39
|
+
openReport: 'Open indexing report',
|
|
40
|
+
emptyNoObservation: 'Google hasn\'t reported coverage for this Site yet. Breakdown appears after the first Search Console sync.',
|
|
41
|
+
emptyAllIndexed: 'Every submitted URL is indexed, so there is nothing to break down.',
|
|
42
|
+
emptyUnattributedOne: 'Google hasn\'t attributed a reason to the {count} URL it has not indexed.',
|
|
43
|
+
emptyUnattributedMany: 'Google hasn\'t attributed a reason to the {count} URLs it has not indexed.',
|
|
44
|
+
},
|
|
45
|
+
issues: {
|
|
46
|
+
stackTitle: 'Reported URLs by issue',
|
|
47
|
+
tableLabel: 'Indexing issues across Sites',
|
|
48
|
+
issue: 'Issue',
|
|
49
|
+
urls: 'URLs',
|
|
50
|
+
sites: 'Sites',
|
|
51
|
+
mostAffected: 'Most affected',
|
|
52
|
+
emptyTitle: 'No issues reported',
|
|
53
|
+
emptyBody: 'Google reports no issue counts for these Sites. Issue counts may not explain every URL that is not indexed.',
|
|
54
|
+
},
|
|
55
|
+
changes: {
|
|
56
|
+
window: 'Last {days} days',
|
|
57
|
+
opened: 'First recorded',
|
|
58
|
+
cleared: 'Cleared',
|
|
59
|
+
legendLabel: 'Chart legend',
|
|
60
|
+
chartLabel: 'First recorded issues above zero and cleared issues below zero, per day',
|
|
61
|
+
chartCaption: 'First recorded and cleared issues per day',
|
|
62
|
+
day: 'Day',
|
|
63
|
+
tableLabel: 'Indexing changes by Site',
|
|
64
|
+
site: 'Site',
|
|
65
|
+
notIndexed: 'Not indexed',
|
|
66
|
+
change: 'Change',
|
|
67
|
+
since: 'since {date}',
|
|
68
|
+
sampledCounts: 'Reads up to 100 URLs per reason on a large Site, so this count can be below the real total.',
|
|
69
|
+
emptyTitle: 'No indexing changes recorded',
|
|
70
|
+
emptyBody: 'Search Console reported no change in not indexed URLs, and no recorded or cleared issues, for these Sites in the last {days} days.',
|
|
71
|
+
},
|
|
72
|
+
diagnosis: {
|
|
73
|
+
statusSevere: 'Action needed',
|
|
74
|
+
statusReview: 'Review',
|
|
75
|
+
statusHealthy: 'Healthy',
|
|
76
|
+
inspecting: 'Inspection in progress',
|
|
77
|
+
waitingForGoogle: 'Waiting for Google',
|
|
78
|
+
setupNeeded: 'Setup needed',
|
|
79
|
+
progressTitle: '{inspected} of {total} sitemap URLs inspected',
|
|
80
|
+
connectTitle: 'Connect Search Console to collect indexing evidence',
|
|
81
|
+
waitingTitle: 'Waiting for indexing data',
|
|
82
|
+
progressLabel: 'Sitemap inspection progress',
|
|
83
|
+
trustFailureBadge: 'Cannot confirm indexing',
|
|
84
|
+
trustFailureTitle: 'Fix the sitemap signal before trusting coverage',
|
|
85
|
+
reviewSitemap: 'Review sitemap',
|
|
86
|
+
verifyScopeBadge: 'Verify scope',
|
|
87
|
+
verifyScopeTitle: 'Indexing scope may have collapsed',
|
|
88
|
+
verifySitemap: 'Verify sitemap inventory',
|
|
89
|
+
partialScopeTitle: 'The inspected sample looks indexed',
|
|
90
|
+
viewInspectedUrls: 'View inspected URLs',
|
|
91
|
+
nextStep: 'Next step',
|
|
92
|
+
reviewSection: 'Review this section',
|
|
93
|
+
leadAction: 'Review these URLs',
|
|
94
|
+
scope: '',
|
|
95
|
+
freshness: 'Diagnosis {freshness}',
|
|
96
|
+
},
|
|
97
|
+
coverageTrend: {
|
|
98
|
+
title: 'Indexed URLs over time',
|
|
99
|
+
scope: 'Inspected sample, not whole-site coverage · {date}',
|
|
100
|
+
viewUrls: 'View inspected URLs',
|
|
101
|
+
indexed: 'Indexed',
|
|
102
|
+
loadingLabel: 'Loading indexing coverage trend',
|
|
103
|
+
errorTitle: 'Coverage trend unavailable',
|
|
104
|
+
errorBody: 'Retry to load the saved coverage snapshots.',
|
|
105
|
+
retry: 'Retry coverage trend',
|
|
106
|
+
insufficientTitle: 'Two snapshots needed',
|
|
107
|
+
insufficientOne: 'The first valid inspection snapshot is ready. The next snapshot will show the trajectory.',
|
|
108
|
+
insufficientNone: 'Coverage history starts after the first two valid inspection snapshots.',
|
|
109
|
+
},
|
|
110
|
+
cohorts: {
|
|
111
|
+
noCompletedCrawl: 'No completed crawl yet, so pages cannot be grouped.',
|
|
112
|
+
noMatch: 'No inspected URL matched a crawled page.',
|
|
113
|
+
spread: '{notIndexed} of {total} pages are not indexed',
|
|
114
|
+
untested: '{spread}, and no group of pages is large enough to compare.',
|
|
115
|
+
uniform: 'No part of this Site indexes worse than the rest. {spread}, spread evenly.',
|
|
116
|
+
outliersOne: 'One part of this Site indexes worse than the rest.',
|
|
117
|
+
outliersMany: '{count} parts of this Site index worse than the rest.',
|
|
118
|
+
comparedGroups: '{count} crawled pages compared across {groups} groups',
|
|
119
|
+
compared: '{count} crawled pages compared',
|
|
120
|
+
notCrawled: '{count} not-indexed URLs are outside this crawl',
|
|
121
|
+
fragments: '{count} fragment URLs excluded',
|
|
122
|
+
cellDetail: '{notIndexed} of {total} pages · {rest} across the rest',
|
|
123
|
+
cellOverlap: '{count} also counted above',
|
|
124
|
+
},
|
|
125
|
+
urls: {
|
|
126
|
+
tableLabel: 'Indexing URLs',
|
|
127
|
+
searchPlaceholder: 'Search URLs…',
|
|
128
|
+
emptyTitle: 'No URLs found',
|
|
129
|
+
emptyBody: 'URLs will appear here once Google returns URL Inspection evidence.',
|
|
130
|
+
itemLabel: 'URLs',
|
|
131
|
+
statusIndexed: 'Indexed',
|
|
132
|
+
statusIndexedTooltip: 'Only URLs Google currently reports as indexed.',
|
|
133
|
+
statusNotIndexed: 'Not indexed',
|
|
134
|
+
statusNotIndexedTooltip: 'Only URLs Google does not currently report as indexed.',
|
|
135
|
+
facetCanonicalMismatch: 'Canonical mismatch',
|
|
136
|
+
facetRichResults: 'Rich results',
|
|
137
|
+
clearFilter: 'Clear {label} filter',
|
|
138
|
+
noIssues: 'No issues',
|
|
139
|
+
issuesMenu: 'Issues',
|
|
140
|
+
issuesMenuLabel: 'Filter by issue type',
|
|
141
|
+
severityError: 'Errors',
|
|
142
|
+
severityWarning: 'Warnings',
|
|
143
|
+
severityInfo: 'Info',
|
|
144
|
+
refreshing: 'Refreshing',
|
|
145
|
+
affected: '{count} URLs affected',
|
|
146
|
+
consolidationTitle: 'Consolidation targets',
|
|
147
|
+
consolidationTooltip: 'Google is folding these pages onto another canonical. Point your canonical at the same URL, or remove the duplication.',
|
|
148
|
+
consolidationEmpty: 'No consolidation targets found.',
|
|
149
|
+
consolidationCount: '{count} pages',
|
|
150
|
+
richResultsScope: 'Rich results · across {count} URLs on this page',
|
|
151
|
+
richResultsInvalid: 'Review {count} invalid',
|
|
152
|
+
richResultsAllValid: 'All valid',
|
|
153
|
+
richResultsEmpty: 'No rich results on this page.',
|
|
154
|
+
richResultsValidCount: '{count} valid',
|
|
155
|
+
richResultsInvalidCount: '{count} invalid',
|
|
156
|
+
notInSitemapOne: 'of the {total} URLs on this page is not in your current sitemap.',
|
|
157
|
+
notInSitemapMany: 'of the {total} URLs on this page are not in your current sitemap.',
|
|
158
|
+
columnUrl: 'URL',
|
|
159
|
+
columnStatus: 'Status',
|
|
160
|
+
columnCoverage: 'Coverage',
|
|
161
|
+
columnInSitemap: 'In sitemap',
|
|
162
|
+
columnLastCrawl: 'Last crawl',
|
|
163
|
+
columnFlags: 'Flags',
|
|
164
|
+
inSitemap: 'In sitemap',
|
|
165
|
+
notInSitemap: 'Not in sitemap',
|
|
166
|
+
openInNewTab: 'Open {path} in new tab',
|
|
167
|
+
flagCanonicalMismatch: 'Canonical Mismatch',
|
|
168
|
+
flagDesktopCrawl: 'Desktop Crawl',
|
|
169
|
+
flagSoft404: 'Soft 404',
|
|
170
|
+
flagRichResults: 'Rich Results',
|
|
171
|
+
noValue: '—',
|
|
172
|
+
today: 'Today',
|
|
173
|
+
yesterday: 'Yesterday',
|
|
174
|
+
remediationLabel: 'Recommended remediation',
|
|
175
|
+
why: 'Why:',
|
|
176
|
+
stageRobots: 'Robots.txt',
|
|
177
|
+
stageFetch: 'Fetch',
|
|
178
|
+
stageIndexing: 'Indexing',
|
|
179
|
+
stageVerdict: 'Verdict',
|
|
180
|
+
pipelineLabel: 'Crawl pipeline',
|
|
181
|
+
detailCrawler: 'Crawler',
|
|
182
|
+
detailLastCrawl: 'Last Crawl',
|
|
183
|
+
detailChecks: 'Checks',
|
|
184
|
+
detailRichResults: 'Rich Results',
|
|
185
|
+
detailCanonical: 'Canonical',
|
|
186
|
+
detailGoogleCanonical: 'Google sees',
|
|
187
|
+
detailMismatch: 'mismatch',
|
|
188
|
+
openUrl: 'Open URL',
|
|
189
|
+
inspectInGsc: 'Inspect in GSC',
|
|
190
|
+
recheck: 'Re-check with Google',
|
|
191
|
+
rechecking: 'Re-checking…',
|
|
192
|
+
recheckTooltip: 'Hit Google URL Inspection now. Each check uses 1 of this Site\'s daily checks.',
|
|
193
|
+
recheckRemainingTooltip: 'Hit Google URL Inspection now. This Site has {remaining} of {limit} daily checks left.',
|
|
194
|
+
cohortChip: 'Cohort: {label}',
|
|
195
|
+
recheckLimitTooltip: 'Daily inspection limit reached for this Site',
|
|
196
|
+
limitTitle: 'Daily inspection limit reached',
|
|
197
|
+
limitBody: 'Google\'s URL Inspection budget for this Site resets in ~{hours}h.',
|
|
198
|
+
recheckedTitle: 'Re-checked with Google',
|
|
199
|
+
recheckedBody: '{url}: {state}',
|
|
200
|
+
recheckedUpdated: 'updated',
|
|
201
|
+
recheckFailedTitle: 'Re-check failed',
|
|
202
|
+
unknownError: 'Unknown error',
|
|
203
|
+
verdicts: {
|
|
204
|
+
PASS: 'Indexed',
|
|
205
|
+
FAIL: 'Not indexed',
|
|
206
|
+
PARTIAL: 'Partial',
|
|
207
|
+
NEUTRAL: 'Not indexed',
|
|
208
|
+
VERDICT_UNSPECIFIED: 'Unknown',
|
|
209
|
+
},
|
|
210
|
+
indexingStates: {
|
|
211
|
+
INDEXING_ALLOWED: 'Allowed',
|
|
212
|
+
INDEXING_NOT_ALLOWED: 'Not allowed',
|
|
213
|
+
INDEXING_STATE_UNSPECIFIED: 'Unknown',
|
|
214
|
+
},
|
|
215
|
+
robotsTxtStates: {
|
|
216
|
+
ALLOWED: 'Allowed',
|
|
217
|
+
DISALLOWED: 'Blocked',
|
|
218
|
+
ROBOTS_TXT_STATE_UNSPECIFIED: 'Unknown',
|
|
219
|
+
},
|
|
220
|
+
pageFetchStates: {
|
|
221
|
+
SUCCESSFUL: 'Successful',
|
|
222
|
+
SOFT_404: 'Soft 404',
|
|
223
|
+
SERVER_ERROR: 'Server error',
|
|
224
|
+
REDIRECT_ERROR: 'Redirect error',
|
|
225
|
+
ACCESS_DENIED: 'Access denied',
|
|
226
|
+
BLOCKED_ROBOTS_TXT: 'Blocked by robots',
|
|
227
|
+
NOT_FOUND: 'Not found',
|
|
228
|
+
PAGE_FETCH_STATE_UNSPECIFIED: 'Unknown',
|
|
229
|
+
},
|
|
230
|
+
crawlers: {
|
|
231
|
+
DESKTOP: 'Desktop',
|
|
232
|
+
MOBILE: 'Mobile',
|
|
233
|
+
CRAWLING_USER_AGENT_UNSPECIFIED: 'Unknown',
|
|
234
|
+
},
|
|
235
|
+
coverageStates: {
|
|
236
|
+
'Submitted and indexed': 'Indexed',
|
|
237
|
+
'Indexed, not submitted in sitemap': 'Indexed (no sitemap)',
|
|
238
|
+
'Crawled - currently not indexed': 'Crawled, not indexed',
|
|
239
|
+
'Discovered - currently not indexed': 'Discovered, not indexed',
|
|
240
|
+
'URL is unknown to Google': 'Unknown to Google',
|
|
241
|
+
'Page with redirect': 'Redirect',
|
|
242
|
+
'Blocked by robots.txt': 'Blocked (robots)',
|
|
243
|
+
'Excluded by \'noindex\' tag': 'Noindex',
|
|
244
|
+
'Soft 404': 'Soft 404',
|
|
245
|
+
'Not found (404)': '404',
|
|
246
|
+
'Server error (5xx)': 'Server error',
|
|
247
|
+
'Duplicate without user-selected canonical': 'Duplicate',
|
|
248
|
+
'Duplicate, Google chose different canonical than user': 'Canonical mismatch',
|
|
249
|
+
'Alternate page with proper canonical tag': 'Canonical alternate',
|
|
250
|
+
'Blocked due to unauthorized request (401)': 'Auth required',
|
|
251
|
+
'Blocked due to access forbidden (403)': 'Forbidden',
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
urlsShell: {
|
|
255
|
+
searchPlaceholder: 'Search…',
|
|
256
|
+
clearSearch: 'Clear search',
|
|
257
|
+
emptyTitle: 'No results',
|
|
258
|
+
itemLabel: 'rows',
|
|
259
|
+
emptySearch: 'No {items} match "{q}"',
|
|
260
|
+
emptyFilter: 'No {items} match the selected filter',
|
|
261
|
+
clearFilters: 'Clear filters',
|
|
262
|
+
refreshFailedTitle: 'Latest refresh failed',
|
|
263
|
+
refreshFailedBody: 'Showing the last successful report.',
|
|
264
|
+
retry: 'Retry',
|
|
265
|
+
loadFailed: 'The URLs could not be loaded',
|
|
266
|
+
total: '{items} total',
|
|
267
|
+
},
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
type Widen<T> = {
|
|
271
|
+
readonly [K in keyof T]: T[K] extends string ? string : Widen<T[K]>
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** Every string the indexing sections render, grouped by section. */
|
|
275
|
+
export type ProIndexingCopy = Widen<typeof DEFAULTS>
|
|
276
|
+
|
|
277
|
+
export const PRO_INDEXING_COPY: ProIndexingCopy = DEFAULTS
|
|
278
|
+
|
|
279
|
+
type DeepPartial<T> = {
|
|
280
|
+
readonly [K in keyof T]?: T[K] extends string ? string : DeepPartial<T[K]>
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** `proIndexing.copy` in app.config: any subset of the defaults. */
|
|
284
|
+
export type ProIndexingCopyOverrides = DeepPartial<ProIndexingCopy>
|
|
285
|
+
|
|
286
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
287
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function mergeCopy<T>(defaults: T, overrides: unknown): T {
|
|
291
|
+
if (!isRecord(defaults) || !isRecord(overrides))
|
|
292
|
+
return defaults
|
|
293
|
+
const merged: Record<string, unknown> = { ...defaults }
|
|
294
|
+
for (const [key, base] of Object.entries(defaults)) {
|
|
295
|
+
const next = overrides[key]
|
|
296
|
+
merged[key] = typeof base === 'string'
|
|
297
|
+
? (typeof next === 'string' ? next : base)
|
|
298
|
+
: mergeCopy(base, next)
|
|
299
|
+
}
|
|
300
|
+
return merged as T
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** The copy with a site's overrides applied. Unknown keys and non-string values are ignored. */
|
|
304
|
+
export function resolveProIndexingCopy(overrides: ProIndexingCopyOverrides | undefined): ProIndexingCopy {
|
|
305
|
+
return mergeCopy(PRO_INDEXING_COPY, overrides)
|
|
306
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Historical indexed counts behind the coverage chart.
|
|
2
|
+
//
|
|
3
|
+
// Moved from nuxtseo.com `layers/pro/gsc/app/utils/indexing-coverage-trend.ts`.
|
|
4
|
+
//
|
|
5
|
+
// The read's totalUrls may count submitted sitemap URLs or inspection rows.
|
|
6
|
+
// It cannot establish an inspected denominator. Only indexedCount has a stable
|
|
7
|
+
// meaning. One valid point is not a trend, so the chart waits for two.
|
|
8
|
+
|
|
9
|
+
export interface IndexingCoverageTrendSourcePoint {
|
|
10
|
+
date: string
|
|
11
|
+
indexedCount: number | null
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IndexingCoverageTrendPoint extends Record<string, unknown> {
|
|
15
|
+
date: string
|
|
16
|
+
indexed: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type IndexingCoverageTrend
|
|
20
|
+
= | { _tag: 'insufficient', validPoints: number }
|
|
21
|
+
| { _tag: 'ready', points: IndexingCoverageTrendPoint[], latest: IndexingCoverageTrendPoint }
|
|
22
|
+
|
|
23
|
+
export type IndexingCoverageTrendViewState
|
|
24
|
+
= | { _tag: 'loading' }
|
|
25
|
+
| { _tag: 'error' }
|
|
26
|
+
| { _tag: 'loaded', trend: IndexingCoverageTrend }
|
|
27
|
+
|
|
28
|
+
const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
|
29
|
+
|
|
30
|
+
export function formatIndexingCoverageDate(raw: unknown): string {
|
|
31
|
+
const date = new Date(String(raw))
|
|
32
|
+
if (Number.isNaN(date.getTime()))
|
|
33
|
+
return String(raw)
|
|
34
|
+
const month = MONTHS[date.getUTCMonth()]
|
|
35
|
+
if (!month)
|
|
36
|
+
return String(raw)
|
|
37
|
+
return `${date.getUTCDate()} ${month}`
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function parsePoint(source: IndexingCoverageTrendSourcePoint): IndexingCoverageTrendPoint | null {
|
|
41
|
+
const date = source.date.trim()
|
|
42
|
+
const indexed = source.indexedCount
|
|
43
|
+
if (
|
|
44
|
+
!date
|
|
45
|
+
|| indexed == null
|
|
46
|
+
|| !Number.isSafeInteger(indexed)
|
|
47
|
+
|| indexed < 0
|
|
48
|
+
) {
|
|
49
|
+
return null
|
|
50
|
+
}
|
|
51
|
+
return { date, indexed }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function buildIndexingCoverageTrend(
|
|
55
|
+
source: ReadonlyArray<IndexingCoverageTrendSourcePoint>,
|
|
56
|
+
): IndexingCoverageTrend {
|
|
57
|
+
const pointsByDate = new Map<string, IndexingCoverageTrendPoint>()
|
|
58
|
+
for (const row of source) {
|
|
59
|
+
const point = parsePoint(row)
|
|
60
|
+
if (point)
|
|
61
|
+
pointsByDate.set(point.date, point)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const points = [...pointsByDate.values()]
|
|
65
|
+
.sort((left, right) => left.date.localeCompare(right.date))
|
|
66
|
+
|
|
67
|
+
const latest = points.at(-1)
|
|
68
|
+
if (points.length < 2 || !latest)
|
|
69
|
+
return { _tag: 'insufficient', validPoints: points.length }
|
|
70
|
+
|
|
71
|
+
return { _tag: 'ready', points, latest }
|
|
72
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// How an indexing issue type and severity look: icon and tone per type, and
|
|
2
|
+
// the severity group styles. The issue catalog itself (`issueDetails`,
|
|
3
|
+
// `severityOrder`) is `@gscdump/sdk/indexing-issues`.
|
|
4
|
+
//
|
|
5
|
+
// Moved from nuxtseo.com `layers/pro/gsc/app/utils/indexing-issues.ts`.
|
|
6
|
+
|
|
7
|
+
import type { IssueSeverity } from '@gscdump/sdk/indexing-issues'
|
|
8
|
+
|
|
9
|
+
// Keyed by `@gscdump/sdk` issue type. A type with no entry falls back to the
|
|
10
|
+
// generic icon, so add an entry when the SDK adds a type.
|
|
11
|
+
export const issueIcons: Record<string, string> = {
|
|
12
|
+
canonical_mismatch: 'compare',
|
|
13
|
+
canonical_cross_domain: 'i-lucide-globe-2',
|
|
14
|
+
canonical_formatting: 'i-lucide-text-cursor-input',
|
|
15
|
+
stale_crawl: 'clock',
|
|
16
|
+
very_stale_crawl: 'clock',
|
|
17
|
+
unknown_to_google: 'help',
|
|
18
|
+
crawled_not_indexed: 'hide',
|
|
19
|
+
discovered_not_indexed: 'search',
|
|
20
|
+
not_found: 'file-x',
|
|
21
|
+
soft_404: 'warning',
|
|
22
|
+
server_error: 'i-lucide-server-crash',
|
|
23
|
+
access_forbidden: 'i-lucide-shield-x',
|
|
24
|
+
access_denied: 'i-lucide-lock',
|
|
25
|
+
blocked_4xx: 'i-lucide-ban',
|
|
26
|
+
redirect_error: 'i-lucide-repeat',
|
|
27
|
+
crawl_error: 'i-lucide-bug',
|
|
28
|
+
blocked_robots: 'shield',
|
|
29
|
+
noindex: 'hide',
|
|
30
|
+
redirect: 'next',
|
|
31
|
+
sitemap_redirect: 'i-lucide-corner-up-right',
|
|
32
|
+
alternate_canonical: 'i-lucide-copy',
|
|
33
|
+
duplicate_no_canonical: 'i-lucide-copy-slash',
|
|
34
|
+
indexed_consider_canonical: 'i-lucide-file-check-2',
|
|
35
|
+
page_removed: 'i-lucide-eraser',
|
|
36
|
+
fragment_url: 'hash',
|
|
37
|
+
not_indexed: 'error',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const severityConfig: Record<IssueSeverity, { label: string, headerIcon: string, border: string, borderActive: string, bg: string, bgActive: string, ring: string, focusRing: string, text: string, iconBg: string }> = {
|
|
41
|
+
error: {
|
|
42
|
+
label: 'Errors',
|
|
43
|
+
headerIcon: 'warning',
|
|
44
|
+
border: 'border-default',
|
|
45
|
+
borderActive: 'border-error/50',
|
|
46
|
+
bg: 'bg-elevated hover:border-error/30',
|
|
47
|
+
bgActive: 'bg-error/10',
|
|
48
|
+
ring: 'ring-2 ring-error/20',
|
|
49
|
+
focusRing: 'focus-visible:ring-error/50',
|
|
50
|
+
text: 'text-error',
|
|
51
|
+
iconBg: 'bg-error/15',
|
|
52
|
+
},
|
|
53
|
+
warning: {
|
|
54
|
+
label: 'Warnings',
|
|
55
|
+
headerIcon: 'caution',
|
|
56
|
+
border: 'border-default',
|
|
57
|
+
borderActive: 'border-warning/50',
|
|
58
|
+
bg: 'bg-elevated hover:border-warning/30',
|
|
59
|
+
bgActive: 'bg-warning/10',
|
|
60
|
+
ring: 'ring-2 ring-warning/20',
|
|
61
|
+
focusRing: 'focus-visible:ring-warning/50',
|
|
62
|
+
text: 'text-warning',
|
|
63
|
+
iconBg: 'bg-warning/15',
|
|
64
|
+
},
|
|
65
|
+
info: {
|
|
66
|
+
label: 'Info',
|
|
67
|
+
headerIcon: 'note',
|
|
68
|
+
border: 'border-default',
|
|
69
|
+
borderActive: 'border-info/50',
|
|
70
|
+
bg: 'bg-elevated hover:border-info/30',
|
|
71
|
+
bgActive: 'bg-info/10',
|
|
72
|
+
ring: 'ring-2 ring-info/20',
|
|
73
|
+
focusRing: 'focus-visible:ring-info/50',
|
|
74
|
+
text: 'text-info',
|
|
75
|
+
iconBg: 'bg-info/15',
|
|
76
|
+
},
|
|
77
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// The Portfolio Overview figures: every value a Site and the Portfolio show on
|
|
2
|
+
// the Overview, from one reading per Site. Pure. The tiles, the stack chart,
|
|
3
|
+
// and a site's own per-Site rows all read this one model, so they agree.
|
|
4
|
+
//
|
|
5
|
+
// Moved from nuxtseo.com `layers/pro/gsc/app/components/pro/ProSiteGroupIndexing.vue`.
|
|
6
|
+
|
|
7
|
+
import type { IndexingMarkdownSite, IndexingReadingWindow, IndexingStack, IndexingTrendReading, IndexingWindowDays, IndexingWindowReading, PortfolioIndexingTrendPoint } from '@gscdump/sdk/indexing'
|
|
8
|
+
import type { IndexingPortfolioEntry } from './portfolio'
|
|
9
|
+
import { crawlErrorCount, indexedRateChange, notIndexedStack, portfolioIndexingTrend, portfolioRateChangeOver, siteIndexingReading } from '@gscdump/sdk/indexing'
|
|
10
|
+
|
|
11
|
+
export interface IndexingPortfolioOverviewModel {
|
|
12
|
+
/** Each Site's reading at the window end, by Site id. Null when the Site has none for the window. */
|
|
13
|
+
readonly readings: ReadonlyMap<string, IndexingWindowReading | null>
|
|
14
|
+
/** Summed over the Sites with a reading. Null when none has one. */
|
|
15
|
+
readonly indexed: { readonly indexed: number, readonly total: number, readonly percent: number } | null
|
|
16
|
+
/** Summed per Site, so a Site share column adds up. Null when no Site has a reading. */
|
|
17
|
+
readonly notIndexed: number | null
|
|
18
|
+
/** Crawl errors at the window end over the Sites with a trend reading. Null when none has one. */
|
|
19
|
+
readonly crawlErrors: number | null
|
|
20
|
+
/** The Portfolio trend over the Sites with a reading. */
|
|
21
|
+
readonly trend: PortfolioIndexingTrendPoint[]
|
|
22
|
+
/** The indexed rate change across the window, in points. */
|
|
23
|
+
readonly indexedChange: number | null
|
|
24
|
+
/** The indexed rate change over 7 days, in points. */
|
|
25
|
+
readonly change7d: number | null
|
|
26
|
+
readonly stack: IndexingStack
|
|
27
|
+
/** Number of Sites with a reading. */
|
|
28
|
+
readonly sitesWithReading: number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function inWindow(point: { date: string }, window: IndexingWindowDays): boolean {
|
|
32
|
+
return point.date >= window.start && point.date <= window.end
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** URLs at stake for a Site: inspected minus indexed. Null without a reading. */
|
|
36
|
+
export function unindexedCount(reading: IndexingWindowReading | null | undefined): number | null {
|
|
37
|
+
return reading ? Math.max(0, reading.totalUrls - reading.indexed) : null
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Crawl errors on a Site's reading. A reading with no trend point counts 0. */
|
|
41
|
+
export function readingErrors(reading: IndexingWindowReading | null | undefined): number {
|
|
42
|
+
return reading?.point ? crawlErrorCount(reading.point) : 0
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function buildPortfolioOverview(entries: readonly IndexingPortfolioEntry[], window: IndexingReadingWindow): IndexingPortfolioOverviewModel {
|
|
46
|
+
const readings = new Map(entries.map(entry => [entry.site.id, siteIndexingReading(entry.summary, entry.trend, window)]))
|
|
47
|
+
const withReading = entries.filter(entry => readings.get(entry.site.id))
|
|
48
|
+
|
|
49
|
+
let indexed = 0
|
|
50
|
+
let total = 0
|
|
51
|
+
for (const entry of withReading) {
|
|
52
|
+
const reading = readings.get(entry.site.id)!
|
|
53
|
+
indexed += reading.indexed
|
|
54
|
+
total += reading.totalUrls
|
|
55
|
+
}
|
|
56
|
+
const notIndexedCounts = withReading.map(entry => unindexedCount(readings.get(entry.site.id))!)
|
|
57
|
+
const errorReadings = withReading.filter(entry => readings.get(entry.site.id)?.point)
|
|
58
|
+
const trend = portfolioIndexingTrend(withReading.map(entry => entry.trend), window)
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
readings,
|
|
62
|
+
indexed: withReading.length ? { indexed, total, percent: total > 0 ? (indexed / total) * 100 : 0 } : null,
|
|
63
|
+
notIndexed: notIndexedCounts.length ? notIndexedCounts.reduce((sum, count) => sum + count, 0) : null,
|
|
64
|
+
crawlErrors: errorReadings.length ? errorReadings.reduce((sum, entry) => sum + readingErrors(readings.get(entry.site.id)), 0) : null,
|
|
65
|
+
trend,
|
|
66
|
+
indexedChange: indexedRateChange(trend),
|
|
67
|
+
change7d: portfolioRateChangeOver(trend, 7),
|
|
68
|
+
stack: notIndexedStack(withReading.map(entry => ({ id: entry.site.id, label: entry.site.label, trend: entry.trend })), window),
|
|
69
|
+
sitesWithReading: withReading.length,
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** A Site's share of the Portfolio not-indexed total, as display text. Null below two Sites with a reading or a zero total. */
|
|
74
|
+
export function notIndexedShare(model: IndexingPortfolioOverviewModel, siteId: string): string | null {
|
|
75
|
+
const count = unindexedCount(model.readings.get(siteId))
|
|
76
|
+
const total = model.notIndexed
|
|
77
|
+
if (count == null || !total || model.sitesWithReading < 2)
|
|
78
|
+
return null
|
|
79
|
+
const share = count / total * 100
|
|
80
|
+
return share > 0 && share < 1 ? '<1%' : `${Math.round(share)}%`
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** A Site's share of the Portfolio indexed total, in whole percent. Null without one. */
|
|
84
|
+
export function indexedShare(model: IndexingPortfolioOverviewModel, siteId: string): number | null {
|
|
85
|
+
const value = model.readings.get(siteId)?.indexed
|
|
86
|
+
if (!value || !model.indexed?.indexed)
|
|
87
|
+
return null
|
|
88
|
+
return Math.round((value / model.indexed.indexed) * 100)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The days of a Site's trend inside the window. */
|
|
92
|
+
export function windowTrend(trend: readonly IndexingTrendReading[], window: IndexingWindowDays): IndexingTrendReading[] {
|
|
93
|
+
return trend.filter(point => inWindow(point, window))
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** One Site as the Markdown export takes it. */
|
|
97
|
+
export function portfolioMarkdownSite(entry: IndexingPortfolioEntry, model: IndexingPortfolioOverviewModel, window: IndexingWindowDays, hostname: string): IndexingMarkdownSite {
|
|
98
|
+
const reading = model.readings.get(entry.site.id) ?? null
|
|
99
|
+
const latest = reading?.point
|
|
100
|
+
return {
|
|
101
|
+
name: entry.site.label,
|
|
102
|
+
hostname,
|
|
103
|
+
hasGsc: entry.site.dataId !== null,
|
|
104
|
+
indexed: reading?.indexed ?? null,
|
|
105
|
+
totalUrls: reading?.totalUrls ?? null,
|
|
106
|
+
indexedPercent: reading?.indexedPercent ?? null,
|
|
107
|
+
change7d: reading?.change7d ?? null,
|
|
108
|
+
change28d: reading?.change28d ?? null,
|
|
109
|
+
trend: reading
|
|
110
|
+
? windowTrend(entry.trend, window).map(point => ({ date: point.date, indexedPercent: point.indexedPercent, errors: crawlErrorCount(point) }))
|
|
111
|
+
: [],
|
|
112
|
+
latestIssues: latest?.issues
|
|
113
|
+
? {
|
|
114
|
+
notFound: latest.issues.notFound ?? 0,
|
|
115
|
+
soft404: latest.issues.soft404 ?? 0,
|
|
116
|
+
serverError: latest.issues.serverError ?? 0,
|
|
117
|
+
}
|
|
118
|
+
: null,
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// The Portfolio as the indexing sections read it: one entry per Site, with the
|
|
2
|
+
// state of its indexing read. Pure. The site maps its own per-Site state onto
|
|
3
|
+
// entries once, and every Portfolio section agrees on what loading, failed,
|
|
4
|
+
// and covered mean.
|
|
5
|
+
//
|
|
6
|
+
// Moved from nuxtseo.com `layers/pro/gsc/app/composables/useIndexingGroupFetchState.ts`.
|
|
7
|
+
|
|
8
|
+
import type { IndexingPortfolioSite, IndexingSummaryReading, IndexingTrendReading } from '@gscdump/sdk/indexing'
|
|
9
|
+
import type { IndexingSite } from './source'
|
|
10
|
+
import { fillCopy } from '@nuxtseo/pro-shell/shared/copy'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The state of a Site's indexing read. `idle` has not started, which counts as
|
|
14
|
+
* pending: reads are staggered, and loading must never read as a result.
|
|
15
|
+
*/
|
|
16
|
+
export type IndexingReadState
|
|
17
|
+
= | { readonly _tag: 'idle' }
|
|
18
|
+
| { readonly _tag: 'loading' }
|
|
19
|
+
| { readonly _tag: 'failed' }
|
|
20
|
+
| { readonly _tag: 'settled' }
|
|
21
|
+
|
|
22
|
+
export interface IndexingPortfolioEntry {
|
|
23
|
+
readonly site: IndexingSite
|
|
24
|
+
readonly read: IndexingReadState
|
|
25
|
+
/** The last summary the read returned. Kept while a refresh runs. */
|
|
26
|
+
readonly summary: IndexingSummaryReading | null
|
|
27
|
+
/** Oldest first. Empty until the read returns one. */
|
|
28
|
+
readonly trend: readonly IndexingTrendReading[]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** True when the entry has a coverage observation. A zero denominator has none yet. */
|
|
32
|
+
export function hasCoverageObservation(summary: Pick<IndexingSummaryReading, 'totalUrls'> | null | undefined): boolean {
|
|
33
|
+
return !!summary && summary.totalUrls > 0
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A linked Site that has not failed is pending until its read settles. */
|
|
37
|
+
export function isEntryPending(entry: IndexingPortfolioEntry): boolean {
|
|
38
|
+
return entry.site.dataId !== null && (entry.read._tag === 'loading' || entry.read._tag === 'idle')
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface IndexingPortfolioFetchCopy {
|
|
42
|
+
readonly failedOne: string
|
|
43
|
+
readonly failedMany: string
|
|
44
|
+
readonly excludesOne: string
|
|
45
|
+
readonly excludesMany: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface IndexingPortfolioFetchState {
|
|
49
|
+
readonly isPending: boolean
|
|
50
|
+
readonly failed: readonly IndexingPortfolioEntry[]
|
|
51
|
+
/** Null when no Site failed. */
|
|
52
|
+
readonly errorDescription: string | null
|
|
53
|
+
/** Totals sum only the Sites that loaded, so they say which Sites they leave out. Null when none failed. */
|
|
54
|
+
readonly partialTotalsNote: string | null
|
|
55
|
+
readonly hasCoverage: boolean
|
|
56
|
+
/** Entries with a coverage observation and a trend, as the stack and issue maths take them. */
|
|
57
|
+
readonly coverageSites: IndexingPortfolioSite[]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function portfolioFetchState(entries: readonly IndexingPortfolioEntry[], copy: IndexingPortfolioFetchCopy): IndexingPortfolioFetchState {
|
|
61
|
+
const failed = entries.filter(entry => entry.read._tag === 'failed')
|
|
62
|
+
const count = failed.length
|
|
63
|
+
return {
|
|
64
|
+
isPending: entries.some(isEntryPending),
|
|
65
|
+
failed,
|
|
66
|
+
errorDescription: count === 0
|
|
67
|
+
? null
|
|
68
|
+
: count === 1
|
|
69
|
+
? fillCopy(copy.failedOne, { site: failed[0]!.site.label })
|
|
70
|
+
: fillCopy(copy.failedMany, { count }),
|
|
71
|
+
partialTotalsNote: count === 0
|
|
72
|
+
? null
|
|
73
|
+
: count === 1 ? copy.excludesOne : fillCopy(copy.excludesMany, { count }),
|
|
74
|
+
hasCoverage: entries.some(entry => hasCoverageObservation(entry.summary)),
|
|
75
|
+
coverageSites: entries.flatMap(entry => hasCoverageObservation(entry.summary) && entry.trend.length
|
|
76
|
+
? [{ id: entry.site.id, label: entry.site.label, trend: entry.trend }]
|
|
77
|
+
: []),
|
|
78
|
+
}
|
|
79
|
+
}
|