@nuxtseo/pro-indexing 0.0.0-stage → 0.1.4
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 +237 -2
- package/app/app.config.ts +11 -0
- package/app/components/IndexingCapabilityGate.vue +20 -0
- package/app/components/IndexingCohortList.vue +126 -0
- package/app/components/IndexingCoverageTrend.vue +134 -0
- package/app/components/IndexingCrawlPipeline.vue +208 -0
- package/app/components/IndexingDiagnosisPanel.vue +226 -0
- package/app/components/IndexingPortfolioChanges.vue +320 -0
- package/app/components/IndexingPortfolioIssues.vue +202 -0
- package/app/components/IndexingPortfolioOverview.vue +204 -0
- package/app/components/IndexingSiteIssues.vue +123 -0
- package/app/components/IndexingUrlsTable.vue +1096 -0
- package/app/components/IndexingUrlsTableShell.vue +231 -0
- package/app/composables/useIndexingSource.ts +27 -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 +16 -0
- package/shared/copy.ts +169 -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 +138 -0
package/shared/source.ts
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// The IndexingSource: the one adapter every indexing section reads. Each site
|
|
2
|
+
// builds it once from its own data layer and provides it above the sections
|
|
3
|
+
// (`provideIndexingSource`). The layer calls its reads in a section's setup and
|
|
4
|
+
// renders their state; it never fetches.
|
|
5
|
+
//
|
|
6
|
+
// A required read is one every site can answer from the hosted gscdump API. An
|
|
7
|
+
// optional field is a capability: a site that leaves it out does not have the
|
|
8
|
+
// feature, and the section that needs it does not render.
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
|
+
GscdumpCanonicalMismatchesResponse,
|
|
12
|
+
GscdumpIndexingDiagnosticsResponse,
|
|
13
|
+
GscdumpIndexingUrl,
|
|
14
|
+
GscdumpIndexingUrlsResponse,
|
|
15
|
+
IndexingInspectRateLimited,
|
|
16
|
+
IndexingInspectResponse,
|
|
17
|
+
IndexingUrlsParams,
|
|
18
|
+
} from '@gscdump/contracts'
|
|
19
|
+
import type { IndexCohortsResponse, IndexingDiagnoseInput, IndexingOverviewDiagnosis } from '@gscdump/sdk/indexing'
|
|
20
|
+
import type { MaybeRefOrGetter, Ref } from 'vue'
|
|
21
|
+
import type { IndexingChangesRollup } from './changes'
|
|
22
|
+
|
|
23
|
+
/** The state of one read. `idle` has not started; `pending` is in flight. */
|
|
24
|
+
export type IndexingReadStatus = 'idle' | 'pending' | 'success' | 'error'
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* One reactive read. Map the site's own query composable onto it, so caching,
|
|
28
|
+
* SSR, and deduping stay the site's. `data` keeps the last good value while a
|
|
29
|
+
* refresh runs.
|
|
30
|
+
*/
|
|
31
|
+
export interface IndexingRead<T> {
|
|
32
|
+
readonly data: Readonly<Ref<T | null | undefined>>
|
|
33
|
+
readonly status: Readonly<Ref<IndexingReadStatus>>
|
|
34
|
+
readonly error: Readonly<Ref<unknown>>
|
|
35
|
+
readonly refresh: () => Promise<void>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** A Site as the indexing sections address it. */
|
|
39
|
+
export interface IndexingSite {
|
|
40
|
+
/** The site's own Site id. */
|
|
41
|
+
readonly id: string
|
|
42
|
+
/** What the route map's `[site]` token takes: an id, a public id, or a Site URL. */
|
|
43
|
+
readonly ref: string
|
|
44
|
+
readonly label: string
|
|
45
|
+
/** The Site URL, for its favicon. Null when unknown. */
|
|
46
|
+
readonly url: string | null
|
|
47
|
+
/**
|
|
48
|
+
* The id the source reads indexing data with, such as a gscdump Site id.
|
|
49
|
+
* Null when Search Console is not linked: every read stays idle.
|
|
50
|
+
*/
|
|
51
|
+
readonly dataId: string | null
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** One reference action of a diagnosis, as the URLs table explains it. */
|
|
55
|
+
export interface IndexingDiagnosisAction {
|
|
56
|
+
readonly id: IndexingOverviewDiagnosis['recommendedActions'][number]['id']
|
|
57
|
+
readonly title: string
|
|
58
|
+
readonly detail: string
|
|
59
|
+
readonly why: string
|
|
60
|
+
readonly source: { readonly url: string, readonly label: string }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The diagnosis a site computes. The layer reads its reason, summary, and actions. */
|
|
64
|
+
export interface IndexingSiteDiagnosis extends IndexingOverviewDiagnosis {
|
|
65
|
+
/** `severe` reads as "Action needed", `watch` as "Review", `ok` as "Healthy" unless a reason remains. */
|
|
66
|
+
readonly severity: 'ok' | 'watch' | 'severe'
|
|
67
|
+
readonly summary: string
|
|
68
|
+
readonly recommendedActions: ReadonlyArray<IndexingDiagnosisAction>
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type IndexingInspectResult = IndexingInspectResponse | IndexingInspectRateLimited
|
|
72
|
+
|
|
73
|
+
/** Sites with a Sitemap problem across the Portfolio, by `IndexingSite.id`. */
|
|
74
|
+
export interface IndexingSitemapProblems {
|
|
75
|
+
/** Sites whose Sitemap does not answer. */
|
|
76
|
+
readonly unreachable: readonly string[]
|
|
77
|
+
/** Sites whose Sitemap Search Console reports with errors. */
|
|
78
|
+
readonly errors: readonly string[]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
type SiteInput = MaybeRefOrGetter<IndexingSite | null | undefined>
|
|
82
|
+
|
|
83
|
+
export interface IndexingSource {
|
|
84
|
+
/** The Site's indexing diagnostics: summary, issues, and meta. */
|
|
85
|
+
readonly diagnostics: (site: SiteInput) => IndexingRead<GscdumpIndexingDiagnosticsResponse>
|
|
86
|
+
/** One page of the Site's inspected URLs. */
|
|
87
|
+
readonly urls: (site: SiteInput, params: MaybeRefOrGetter<IndexingUrlsParams>) => IndexingRead<GscdumpIndexingUrlsResponse>
|
|
88
|
+
|
|
89
|
+
// Capabilities. A section that needs a missing one does not render.
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The site's diagnosis of a Site's indexing. With it, the URLs table explains
|
|
93
|
+
* the filtered issue. `diagnoseIndexing` reads Crawl evidence, so it stays in
|
|
94
|
+
* the site.
|
|
95
|
+
*/
|
|
96
|
+
readonly diagnose?: (input: IndexingDiagnoseInput<GscdumpIndexingUrl>) => IndexingSiteDiagnosis
|
|
97
|
+
/**
|
|
98
|
+
* Re-inspect URLs with Google now. With it, each URL row offers "Re-check
|
|
99
|
+
* with Google". The section calls it once in setup and keeps the function.
|
|
100
|
+
*/
|
|
101
|
+
readonly inspect?: () => (site: IndexingSite, urls: readonly string[]) => Promise<IndexingInspectResult>
|
|
102
|
+
/** Google's chosen canonicals. With it, the URLs table shows consolidation targets. */
|
|
103
|
+
readonly canonicalMismatches?: (site: SiteInput, enabled: MaybeRefOrGetter<boolean>) => IndexingRead<GscdumpCanonicalMismatchesResponse>
|
|
104
|
+
/** Index cohorts for a Site. With it, the Index cohorts section renders. */
|
|
105
|
+
readonly cohorts?: (site: SiteInput) => IndexingRead<IndexCohortsResponse>
|
|
106
|
+
/** The live Sitemap check across the Portfolio. With it, the Sitemap problems tile renders. */
|
|
107
|
+
readonly sitemapProblems?: () => IndexingRead<IndexingSitemapProblems>
|
|
108
|
+
/** The Portfolio changes roll-up. With it, the Portfolio Changes section renders. */
|
|
109
|
+
readonly changesRollup?: () => IndexingRead<IndexingChangesRollup>
|
|
110
|
+
/** IndexNow submission. The site draws its own IndexNow panel inside `IndexingCapabilityGate`. */
|
|
111
|
+
readonly indexNow?: true
|
|
112
|
+
/** Watched URLs. The site draws its own Watched URLs panel inside `IndexingCapabilityGate`. */
|
|
113
|
+
readonly watchedUrls?: true
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** The optional fields of an IndexingSource. */
|
|
117
|
+
export const INDEXING_CAPABILITIES = [
|
|
118
|
+
'diagnose',
|
|
119
|
+
'inspect',
|
|
120
|
+
'canonicalMismatches',
|
|
121
|
+
'cohorts',
|
|
122
|
+
'sitemapProblems',
|
|
123
|
+
'changesRollup',
|
|
124
|
+
'indexNow',
|
|
125
|
+
'watchedUrls',
|
|
126
|
+
] as const satisfies ReadonlyArray<keyof IndexingSource>
|
|
127
|
+
|
|
128
|
+
export type IndexingCapability = typeof INDEXING_CAPABILITIES[number]
|
|
129
|
+
|
|
130
|
+
/** True when the source has the capability. A missing source has none. */
|
|
131
|
+
export function hasIndexingCapability(source: IndexingSource | null | undefined, capability: IndexingCapability): boolean {
|
|
132
|
+
return source?.[capability] !== undefined
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** The capabilities a source has, in `INDEXING_CAPABILITIES` order. */
|
|
136
|
+
export function indexingCapabilities(source: IndexingSource | null | undefined): IndexingCapability[] {
|
|
137
|
+
return INDEXING_CAPABILITIES.filter(capability => hasIndexingCapability(source, capability))
|
|
138
|
+
}
|