Skip to content

Commit 90a9f7d

Browse files
authored
feat: Add hooks for content scraper (#231)
* update generated content * Add wrapper with stable class name around main content to help scrapers
1 parent 722ee2a commit 90a9f7d

File tree

4 files changed

+42
-19
lines changed

4 files changed

+42
-19
lines changed

pages/sitemap.xml.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ export default function SiteMap() {
3636
// getServerSideProps will do the heavy lifting
3737
}
3838

39-
async function generateSiteMap({
39+
function generateSiteMap({
4040
repos,
4141
}: {
42-
repos: Awaited<ReturnType<typeof getRepos>>
43-
}) {
42+
repos?: Awaited<ReturnType<typeof getRepos>>
43+
} = {}) {
4444
const lastMod = new Date().toISOString()
4545

4646
// We generate the XML sitemap with the posts data
@@ -56,7 +56,7 @@ async function generateSiteMap({
5656
return sitemap
5757
}
5858

59-
let cachedSiteMap: string
59+
let cachedSiteMap: string = generateSiteMap()
6060

6161
export async function getServerSideProps({ res }) {
6262
// We make an API call to gather the URLs for our site
@@ -66,6 +66,7 @@ export async function getServerSideProps({ res }) {
6666

6767
if (!reposError) {
6868
sitemap = await generateSiteMap({ repos })
69+
cachedSiteMap = sitemap
6970
}
7071

7172
res.setHeader('Content-Type', 'text/xml')

src/components/MainContent.tsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,22 @@ export default function MainContent({ Component, title, description }) {
101101
<Breadcrumbs />
102102
</BreadcrumbsWrapper>
103103
<ContentWrapper>
104-
{(title || description) && (
105-
<ContentHeader
106-
title={title}
107-
description={description}
108-
pageHasContent={(markdoc?.content as any)?.children?.length > 0}
109-
/>
110-
)}
111-
<Component {...pageProps} />
112-
{isAppCatalogIndex && (
113-
<>
114-
<Heading level={2}>Our Catalog</Heading>
115-
<AppsList />
116-
</>
117-
)}
104+
<article className="primary-content">
105+
{(title || description) && (
106+
<ContentHeader
107+
title={title}
108+
description={description}
109+
pageHasContent={(markdoc?.content as any)?.children?.length > 0}
110+
/>
111+
)}
112+
<Component {...pageProps} />
113+
{isAppCatalogIndex && (
114+
<>
115+
<Heading level={2}>Our Catalog</Heading>
116+
<AppsList />
117+
</>
118+
)}
119+
</article>
118120
<PageDivider />
119121
{markdoc?.file?.path && (
120122
<EditOnGithub>

src/generated/graphql.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export type Account = {
3939
paymentMethods?: Maybe<PaymentMethodConnection>;
4040
rootUser?: Maybe<User>;
4141
subscription?: Maybe<PlatformSubscription>;
42+
trialed?: Maybe<Scalars['Boolean']['output']>;
4243
updatedAt?: Maybe<Scalars['DateTime']['output']>;
4344
userCount?: Maybe<Scalars['String']['output']>;
4445
workosConnectionId?: Maybe<Scalars['String']['output']>;
@@ -1363,6 +1364,7 @@ export type IntegrationWebhookEdge = {
13631364
export type Invite = {
13641365
__typename?: 'Invite';
13651366
account?: Maybe<Account>;
1367+
admin?: Maybe<Scalars['Boolean']['output']>;
13661368
email?: Maybe<Scalars['String']['output']>;
13671369
existing: Scalars['Boolean']['output'];
13681370
expiresAt?: Maybe<Scalars['DateTime']['output']>;
@@ -1375,6 +1377,7 @@ export type Invite = {
13751377
};
13761378

13771379
export type InviteAttributes = {
1380+
admin?: InputMaybe<Scalars['Boolean']['input']>;
13781381
email?: InputMaybe<Scalars['String']['input']>;
13791382
inviteGroups?: InputMaybe<Array<InputMaybe<BindingAttributes>>>;
13801383
};
@@ -1621,7 +1624,8 @@ export enum NotificationType {
16211624
IncidentUpdate = 'INCIDENT_UPDATE',
16221625
Locked = 'LOCKED',
16231626
Mention = 'MENTION',
1624-
Message = 'MESSAGE'
1627+
Message = 'MESSAGE',
1628+
Pending = 'PENDING'
16251629
}
16261630

16271631
export type OauthAttributes = {
@@ -2026,6 +2030,7 @@ export type PlatformPlan = {
20262030
lineItems?: Maybe<Array<Maybe<PlatformPlanItem>>>;
20272031
name: Scalars['String']['output'];
20282032
period: PaymentPeriod;
2033+
trial?: Maybe<Scalars['Boolean']['output']>;
20292034
updatedAt?: Maybe<Scalars['DateTime']['output']>;
20302035
visible: Scalars['Boolean']['output'];
20312036
};
@@ -2043,9 +2048,12 @@ export type PlatformSubscription = {
20432048
__typename?: 'PlatformSubscription';
20442049
externalId?: Maybe<Scalars['String']['output']>;
20452050
id: Scalars['ID']['output'];
2051+
insertedAt?: Maybe<Scalars['DateTime']['output']>;
20462052
latestInvoice?: Maybe<Invoice>;
20472053
lineItems?: Maybe<Array<Maybe<PlatformSubscriptionLineItems>>>;
20482054
plan?: Maybe<PlatformPlan>;
2055+
trialUntil?: Maybe<Scalars['DateTime']['output']>;
2056+
updatedAt?: Maybe<Scalars['DateTime']['output']>;
20492057
};
20502058

20512059
export type PlatformSubscriptionLineItems = {
@@ -2627,6 +2635,7 @@ export type RootMutationType = {
26272635
acceptIncident?: Maybe<Incident>;
26282636
acceptLogin?: Maybe<OauthResponse>;
26292637
acquireLock?: Maybe<ApplyLock>;
2638+
beginTrial?: Maybe<PlatformSubscription>;
26302639
cancelPlatformSubscription?: Maybe<PlatformSubscription>;
26312640
completeIncident?: Maybe<Incident>;
26322641
createArtifact?: Maybe<Artifact>;
@@ -2729,6 +2738,7 @@ export type RootMutationType = {
27292738
realizeInvite?: Maybe<User>;
27302739
realizeResetToken?: Maybe<Scalars['Boolean']['output']>;
27312740
rebootShell?: Maybe<CloudShell>;
2741+
release?: Maybe<Scalars['Boolean']['output']>;
27322742
releaseLock?: Maybe<ApplyLock>;
27332743
resetInstallations?: Maybe<Scalars['Int']['output']>;
27342744
restartShell?: Maybe<Scalars['Boolean']['output']>;
@@ -3288,6 +3298,13 @@ export type RootMutationTypeRealizeResetTokenArgs = {
32883298
};
32893299

32903300

3301+
export type RootMutationTypeReleaseArgs = {
3302+
repositoryId?: InputMaybe<Scalars['ID']['input']>;
3303+
repositoryName?: InputMaybe<Scalars['String']['input']>;
3304+
tags?: InputMaybe<Array<Scalars['String']['input']>>;
3305+
};
3306+
3307+
32913308
export type RootMutationTypeReleaseLockArgs = {
32923309
attributes: LockAttributes;
32933310
repository: Scalars['String']['input'];

src/generated/pages.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@
224224
{
225225
"path": "/reference/operator-guides"
226226
},
227+
{
228+
"path": "/reference/partial-installation"
229+
},
227230
{
228231
"path": "/reference/release-notes"
229232
},

0 commit comments

Comments
 (0)