Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kmelve committed Oct 20, 2019
1 parent 171228f commit ad523b3
Show file tree
Hide file tree
Showing 11 changed files with 24,647 additions and 4,682 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@
/lerna-debug.log

# Lock files
/package-lock.json
/yarn.lock
3 changes: 3 additions & 0 deletions .netlify/state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"siteId": "4a30bb85-84bf-409a-8f97-8dcbfcd337e4"
}
4 changes: 0 additions & 4 deletions studio/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
/dist
/node_modules

# Lock files
/package-lock.json
/yarn.lock
13,370 changes: 13,370 additions & 0 deletions studio/package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion studio/sanity.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"dashboard-widget-netlify",
"@sanity/code-input",
"dashboard-widget-gatsby",
"minesweeper"
"minesweeper",
"seo-tools"
],
"parts": [
{
Expand Down
28 changes: 25 additions & 3 deletions studio/schemas/documents/post.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
import {format} from 'date-fns'

const path = ({publishedAt, slug}) => {
if (!publishedAt || !slug) {
return false
}
const dateSegment = format(publishedAt, 'YYYY/MM')
return `/${dateSegment}/${slug.current}/`
}

export default {
name: 'post',
type: 'document',
title: 'Blog Post',
fieldsets: [
{name: 'social', title: 'Social media handles'}
],
fields: [
{
name: 'title',
Expand Down Expand Up @@ -71,6 +82,19 @@ export default {
name: 'body',
type: 'bodyPortableText',
title: 'Body'
},
{
name: 'seo',
title: 'SEO',
type: 'seo-tools',
options: {
baseUrl: 'https://knutmelvaer.no/blog',
slug (doc) { // (REQUIRED) a function to return the sug of the current page, which will be appended to the baseUrl
const {slug, publishedAt} = doc
console.log(path({slug, publishedAt}))
return path({slug, publishedAt})
}
}
}
],
orderings: [
Expand Down Expand Up @@ -111,12 +135,10 @@ export default {
media: 'mainImage'
},
prepare ({title = 'No title', publishedAt, slug = {}, media}) {
const dateSegment = format(publishedAt, 'YYYY/MM')
const path = `/${dateSegment}/${slug.current}/`
return {
title,
media,
subtitle: publishedAt ? path : 'Missing publishing date'
subtitle: path({publishedAt, slug}) || 'Missing publishing date'
}
}
}
Expand Down
Empty file added views.sql
Empty file.
4 changes: 1 addition & 3 deletions web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,14 @@ public

# Yarn
yarn-error.log
yarn.lock

.pnp/
.pnp.js

# Yarn Integrity file
.yarn-integrity

# Lock files
/package-lock.json
/yarn.lock

# Secrets
.env.development
Loading

0 comments on commit ad523b3

Please sign in to comment.