Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sanity Exhibition Nansen
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
uib-ub
Spesialsamlingene
Utstillinger
Sanity Exhibition Nansen
Commits
5e0564a6
Commit
5e0564a6
authored
3 years ago
by
Tarje Lavik
Browse files
Options
Downloads
Patches
Plain Diff
Add meta title
parent
2936274f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
web/pages/[...slug].js
+12
-7
12 additions, 7 deletions
web/pages/[...slug].js
web/pages/index.js
+2
-0
2 additions, 0 deletions
web/pages/index.js
with
14 additions
and
7 deletions
web/pages/[...slug].js
+
12
−
7
View file @
5e0564a6
import
Head
from
'
next/head
'
import
{
usePreviewSubscription
}
from
'
../lib/sanity
'
import
{
routeQuery
}
from
'
../lib/queries/routeQuery
'
import
{
getClient
}
from
'
../lib/sanity.server
'
import
{
getRoutes
}
from
'
../lib/api
'
import
{
Box
,
Container
,
Text
}
from
'
@chakra-ui/react
'
import
Date
from
'
../components/Date
'
...
...
@@ -6,9 +10,6 @@ import Sections from '../components/Sections/Sections'
import
PortableTextBlock
from
'
../components/PT/PortableTextBlock
'
import
TableOfContent
from
'
../components/Layout/TableOfContent
'
import
Footnotes
from
'
../components/Layout/Footnotes
'
import
{
usePreviewSubscription
}
from
'
../lib/sanity
'
import
{
routeQuery
}
from
'
../lib/queries/routeQuery
'
import
{
getClient
}
from
'
../lib/sanity.server
'
/**
* Helper function to return the correct version of the document
...
...
@@ -42,10 +43,14 @@ export default function Page({ data, preview }) {
// It'll be completely blank when they start!
return
(
<
Layout
preview
=
{
preview
}
site
=
{
page
?.
siteSettings
}
>
{
/* <pre>{JSON.stringify(previewData, null, 2)}</pre> */
}
{
/* <pre>{JSON.stringify(page, null, 2)}</pre> */
}
<
Head
>
<
title
>
{
page
.
route
[
0
].
page
.
label
+
'
-
'
+
page
.
siteSettings
.
title
}
<
/title
>
<
/Head
>
<
Container
maxWidth
=
"
full
"
centerContent
>
{
/* A Page */
}
{
page
?.
route
?.
page
?.
content
&&
<
Sections
sections
=
{
page
.
route
.
page
.
content
}
/>
}
{
page
?.
route
[
0
]
?.
page
?.
content
&&
<
Sections
sections
=
{
page
.
route
[
0
]
.
page
.
content
}
/>
}
{
/* If LinguisticDocument the content is in the body field */
}
{
page
?.
route
[
0
]?.
page
?.
body
&&
<
PortableTextBlock
blocks
=
{
page
.
route
[
0
].
page
.
body
}
/>
}
...
...
@@ -53,9 +58,9 @@ export default function Page({ data, preview }) {
{
page
?.
route
[
0
]?.
page
?.
body
&&
<
Footnotes
blocks
=
{
page
.
route
[
0
].
page
.
body
}
/>
}
{
/* Add TOC */
}
{
page
?.
route
?.
page
?.
body
&&
(
{
page
?.
route
[
0
]
?.
page
?.
body
&&
(
<
Box
position
=
"
fixed
"
left
=
"
10
"
top
=
"
50vh
"
display
=
{{
base
:
'
none
'
,
md
:
'
inherit
'
}}
>
<
TableOfContent
blocks
=
{
page
?.
route
.
page
.
body
}
/
>
<
TableOfContent
blocks
=
{
page
?.
route
[
0
]
.
page
.
body
}
/
>
<
/Box
>
)}
...
...
This diff is collapsed.
Click to expand it.
web/pages/index.js
+
2
−
0
View file @
5e0564a6
import
Head
from
'
next/head
'
import
{
getFrontpage
}
from
'
../lib/api
'
import
Layout
from
'
../components/Layout
'
import
RenderSections
from
'
../components/Sections/RenderSection
'
...
...
@@ -6,6 +7,7 @@ import { Container } from '@chakra-ui/react'
export
default
function
Index
({
data
,
preview
})
{
return
(
<
Layout
preview
=
{
preview
}
site
=
{
data
.
siteSettings
}
>
<
Head
>
{
data
?.
siteSettings
?.
title
&&
<
title
>
{
data
.
siteSettings
.
title
}
<
/title>}</
Head
>
<
Container
maxW
=
"
full
"
>
{
data
.
frontpage
.
content
&&
<
RenderSections
sections
=
{
data
.
frontpage
.
content
}
/>
}
<
/Container
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment