Skip to content

Commit a4d3691

Browse files
timothyisMatthew Sweeney
authored andcommitted
Add back Automatic prerendering (#1257)
* Revert "Revert "Automatic prerendering (#1232)" (#1256)" This reverts commit fa59039. * Remove API page and add route
1 parent fa59039 commit a4d3691

File tree

26 files changed

+1314
-312
lines changed

26 files changed

+1314
-312
lines changed

components/code/inline-code.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const literal = '`'
2+
13
const InlineCode = ({ children, noWrap, color }) => (
24
<code className={noWrap && 'no-wrap'}>
35
{children}
@@ -17,11 +19,11 @@ const InlineCode = ({ children, noWrap, color }) => (
1719
}
1820
1921
code::before {
20-
content: '\`';
22+
content: '${literal}';
2123
}
2224
2325
code::after {
24-
content: '\`';
26+
content: '${literal}';
2527
}
2628
`}
2729
</style>

components/feedback-input/header-feedback.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ class HeaderFeedback extends Component {
232232
const { focused } = this.state
233233
delete props.onFeedback
234234
delete props.textAreaStyle
235+
delete props.hideHeader
235236

236237
return (
237238
<ClickOutside

components/footer/index.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@ const Footer = ({ className }) => {
1515
<ul className="navigation">
1616
<li className="links-title">Company</li>
1717
<li className="home">
18-
<Link prefetch href="/" as="/home">
18+
<Link href="/" as="/home">
1919
<a>Home</a>
2020
</Link>
2121
</li>
2222
<li className="about">
23-
<Link prefetch href="/about">
23+
<Link href="/about">
2424
<a>About</a>
2525
</Link>
2626
</li>
2727
<li className="careers">
28-
<Link prefetch href="/careers">
28+
<Link href="/careers">
2929
<a>Careers</a>
3030
</Link>
3131
</li>
3232
<li className="blog">
33-
<Link prefetch href="/blog">
33+
<Link href="/blog">
3434
<a>Blog</a>
3535
</Link>
3636
</li>
3737
<li className="day">
38-
<Link prefetch href="/day">
38+
<Link href="/day">
3939
<a>ZEIT Day</a>
4040
</Link>
4141
</li>
@@ -46,31 +46,31 @@ const Footer = ({ className }) => {
4646
<a href="/download">Download</a>
4747
</li>
4848
<li className="pricing">
49-
<Link prefetch href="/pricing">
49+
<Link href="/pricing">
5050
<a>Pricing</a>
5151
</Link>
5252
<span>{'/'}</span>
53-
<Link prefetch href="/pricing/calculator">
53+
<Link href="/pricing/calculator">
5454
<a>Calculator</a>
5555
</Link>
5656
</li>
5757
<li className="now-for-github">
58-
<Link prefetch href="/github">
58+
<Link href="/github">
5959
<a>Now for GitHub</a>
6060
</Link>
6161
</li>
6262
<li className="now-for-gitlab">
63-
<Link prefetch href="/gitlab">
63+
<Link href="/gitlab">
6464
<a>Now for GitLab</a>
6565
</Link>
6666
</li>
6767
<li>
68-
<Link prefetch href="/smart-cdn">
68+
<Link href="/smart-cdn">
6969
<a>Smart CDN</a>
7070
</Link>
7171
</li>
7272
<li>
73-
<Link prefetch href="/integrations">
73+
<Link href="/integrations">
7474
<a>Integrations Marketplace</a>
7575
</Link>
7676
</li>
@@ -90,31 +90,31 @@ const Footer = ({ className }) => {
9090
<a href="/examples">Examples</a>
9191
</li>
9292
<li className="tv">
93-
<Link prefetch href="/tv">
93+
<Link href="/tv">
9494
<a>TV</a>
9595
</Link>
9696
</li>
9797
</ul>
9898
<ul className="navigation">
9999
<li className="links-title">More</li>
100100
<li className="oss">
101-
<Link prefetch href="/oss">
101+
<Link href="/oss">
102102
<a>Open Source Software</a>
103103
</Link>
104104
</li>
105105
<li className="design">
106-
<Link prefetch href="/design">
106+
<Link href="/design">
107107
<a>Design Assets</a>
108108
</Link>
109109
</li>
110110

111111
<li className="security">
112-
<Link prefetch href="/security">
112+
<Link href="/security">
113113
<a>Security</a>
114114
</Link>
115115
</li>
116116
<li className="support">
117-
<Link prefetch href="/support">
117+
<Link href="/support">
118118
<a>Support</a>
119119
</Link>
120120
</li>
@@ -124,12 +124,12 @@ const Footer = ({ className }) => {
124124
<li className="links-title" />
125125

126126
<li className="privacy">
127-
<Link prefetch href="/privacy">
127+
<Link href="/privacy">
128128
<a>Privacy Policy</a>
129129
</Link>
130130
</li>
131131
<li className="terms">
132-
<Link prefetch href="/terms">
132+
<Link href="/terms">
133133
<a>Terms of Service</a>
134134
</Link>
135135
</li>

components/layout/docs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,21 +168,21 @@ class withDoc extends React.Component {
168168
!router.pathname.startsWith('/docs/api')
169169
}
170170
>
171-
<Link prefetch href="/docs">
171+
<Link href="/docs">
172172
<a onClick={this.handleIndexClick}>Docs</a>
173173
</Link>
174174
</ToggleItem>
175175
<ToggleItem
176176
active={router.pathname.startsWith('/docs/api')}
177177
>
178-
<Link prefetch href="/docs/api">
178+
<Link href="/docs/api">
179179
<a onClick={this.handleIndexClick}>API Reference</a>
180180
</Link>
181181
</ToggleItem>
182182
<ToggleItem
183183
active={router.pathname.startsWith('/examples')}
184184
>
185-
<Link prefetch href="/examples">
185+
<Link href="/examples">
186186
<a onClick={this.handleIndexClick}>Examples</a>
187187
</Link>
188188
</ToggleItem>

components/layout/index/entry-index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class EntryIndex extends Component {
6565
{entry.title}
6666
</a>
6767
) : (
68-
<Link href={href} as={as} prefetch>
68+
<Link href={href} as={as}>
6969
<a
7070
className={cns({ active: isEntryActive(this.props) })}
7171
onClick={this.handleClick}

components/layout/index/section-index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class SectionIndex extends Component {
8383
{section.title}
8484
</a>
8585
) : (
86-
<Link href={href} as={as} prefetch>
86+
<Link href={href} as={as}>
8787
<a
8888
className={cns('title', { active })}
8989
onClick={this.handleClick}

components/layout/navbar/desktop.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useEffect } from 'react'
2+
import Link from 'next/link'
23
import cn from 'classnames'
3-
import { LinkWithHoverPrefetch } from '~/components/text/link'
44
import qs from 'querystring'
55
import { parse } from 'url'
66
import _scrollIntoViewIfNeeded from 'scroll-into-view-if-needed'
@@ -311,13 +311,9 @@ export class NavLink extends React.Component {
311311
{info.name}
312312
</a>
313313
) : (
314-
<LinkWithHoverPrefetch
315-
href={info.href}
316-
as={info.as || info.href}
317-
onClick={onClick}
318-
>
319-
{info.name}
320-
</LinkWithHoverPrefetch>
314+
<Link href={info.href} as={info.as || info.href}>
315+
<a onClick={onClick}>{info.name}</a>
316+
</Link>
321317
)}
322318
<style jsx>{`
323319
div.selected {

components/layout/navbar/toggle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Link from 'next/link'
44

55
const ActivePageButton = withRouter(({ children, router, href }) => {
66
return (
7-
<Link href={href} prefetch>
7+
<Link href={href}>
88
<span className="active-button">
99
{children}
1010
<style jsx>{`

components/search/autocomplete.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class AutoComplete extends Component {
8080
href={`${hit.url}?query=${encodeURIComponent(this.state.value)}${
8181
hit.anchor ? `${hit.anchor}` : ''
8282
}`}
83-
prefetch
8483
>
8584
<a>
8685
<span className="suggestion__title">

components/text/code.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Code.contextTypes = {
5757
darkBg: PropTypes.bool
5858
}
5959

60+
const literal = '`'
61+
6062
export const InlineCode = ({ children, noWrap, color }) => (
6163
<code className={noWrap && 'no-wrap'}>
6264
{children}
@@ -76,11 +78,11 @@ export const InlineCode = ({ children, noWrap, color }) => (
7678
}
7779
7880
code::before {
79-
content: '\`';
81+
content: '${literal}';
8082
}
8183
8284
code::after {
83-
content: '\`';
85+
content: '${literal}';
8486
}
8587
`}
8688
</style>

0 commit comments

Comments
 (0)