Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

DefaultLayout.tsx 1.9 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  1. import Head from 'next/head'
  2. import { SidebarNav } from 'components/SidebarNav'
  3. import { Header } from 'components/Header'
  4. import { SmallFooter } from 'components/SmallFooter'
  5. import { ScrollButton } from 'components/ScrollButton'
  6. import { SupportSection } from 'components/SupportSection'
  7. import { DeprecationBanner } from 'components/DeprecationBanner'
  8. import { useMainContext } from 'components/context/MainContext'
  9. import { useTranslation } from './hooks/useTranslation'
  10. type Props = { children?: React.ReactNode }
  11. export const DefaultLayout = (props: Props) => {
  12. const { builtAssets, expose, page, error, isHomepageVersion } = useMainContext()
  13. const { t } = useTranslation('errors')
  14. return (
  15. <div className="d-lg-flex">
  16. <Head>
  17. {error === '404' ? (
  18. <title>{t('oops')}</title>
  19. ) : !isHomepageVersion && page.fullTitle ? (
  20. <title>{page.fullTitle}</title>
  21. ) : null}
  22. <script id="expose" type="application/json" dangerouslySetInnerHTML={{ __html: expose }} />
  23. <script src={builtAssets.main.js} />
  24. {/* For Google and Bots */}
  25. {page.introPlainText && <meta name="description" content={page.introPlainText} />}
  26. {page.topics.length > 0 && <meta name="keywords" content={page.topics.join(',')} />}
  27. {page.hidden && <meta name="robots" content="noindex" />}
  28. {page.languageVariants.map((languageVariant) => {
  29. return (
  30. <link
  31. key={languageVariant.href}
  32. rel="alternate"
  33. hrefLang={languageVariant.hreflang}
  34. href={`https://docs.github.com${languageVariant.href}`}
  35. />
  36. )
  37. })}
  38. </Head>
  39. <SidebarNav />
  40. <main className="width-full">
  41. <Header />
  42. <DeprecationBanner />
  43. {props.children}
  44. <SupportSection />
  45. <SmallFooter />
  46. <ScrollButton />
  47. </main>
  48. </div>
  49. )
  50. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...