Skip to content

Commit

Permalink
feat(Blueprints): Added basic article/page Blueprints and site Blueprint
Browse files Browse the repository at this point in the history
  • Loading branch information
holmey committed Apr 1, 2023
1 parent 77dd808 commit 4f38aa1
Show file tree
Hide file tree
Showing 14 changed files with 199 additions and 49 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ Icon
/content/*
!/content/home
!/content/error
!/content/articles
/content/articles/*
!/content/articles/articles.txt
5 changes: 5 additions & 0 deletions content/articles/articles.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Title: Articles

----

Uuid: YmUg8qxLk7uMIDuj
5 changes: 5 additions & 0 deletions site/blueprints/fields/cover.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: files
multiple: false
query: page.images.template('image')
uploads:
template: image
4 changes: 4 additions & 0 deletions site/blueprints/files/blocks/image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# The blocks/image template is automatically assigned to all uploaded
# images in the blocks field. We don't really need a separate blueprint
# for this and can therefor extend the already existing files/image blueprint
extends: files/image
47 changes: 47 additions & 0 deletions site/blueprints/files/image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Each file blueprint must have a title, the title may be different from the file name
title: Image

# Like page blueprints, file blueprints can define a layout with tabs, columns, sections and fields
# File blueprints define what sort of information should get stored in a file's meta data file
# In addition to the fields defined in this example blueprint, you can also set what type of file is acceptable
# when this blueprint is used, which allows you to control what users can upload.
# More about file blueprints: https://getkirby.com/docs/reference/panel/blueprints/file

accept:
type: image

columns:
- width: 1/2
sections:
content:
type: fields
fields:
caption:
label: Caption
type: textarea
size: medium
- width: 1/2
sections:
meta:
type: fields
fields:
alt:
label: Alternative Text
type: text
photographer:
label: Photographer
type: text
width: 2/3
license:
label: License
type: select
width: 1/3
options:
- Unsplash
- CC BY 4.0
- CC BY-SA 4.0
- CC BY-NC 4.0
- CC BY-ND 4.0
link:
label: Link
type: url
26 changes: 26 additions & 0 deletions site/blueprints/pages/article.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
title: Article

tabs:
content:
icon: dashboard
columns:
- width: 2/3
fields:
text:
type: blocks

- width: 1/3
sections:
meta:
type: fields
fields:
cover: fields/cover
date:
type: date
time: true
default: now
author:
type: users
tags: true

seotab: seo
34 changes: 34 additions & 0 deletions site/blueprints/pages/articles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
title: Articles

icon: page

options:
preview: false
create: false
delete: false
duplicate: false
changeStatus: false
changeSlug: false
changeTitle: false

columns:
- width: 2/3
sections:
listed:
extends: sections/articles
label: Published
status: listed
search: true
limit: 2

- width: 1/3
sections:
drafts:
extends: sections/articles
label: Drafts
status: draft

unlisted:
extends: sections/articles
label: In Review
status: unlisted
33 changes: 18 additions & 15 deletions site/blueprints/pages/default.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
title: Default Page
title: Article

tabs:
content:
icon: dashboard
columns:
main:
width: 2/3
- width: 2/3
fields:
text:
type: blocks

- width: 1/3
sections:
fields:
meta:
type: fields
fields:
text:
type: textarea
size: huge
sidebar:
width: 1/3
sections:
pages:
type: pages
template: default
files:
type: files
cover: fields/cover
date:
type: date
time: true
default: now
author:
type: users
tags: true

seotab: seo
17 changes: 8 additions & 9 deletions site/blueprints/pages/error.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
title: Error
icon: 💥
icon: bug

options:
create: false
delete: false
duplicate: false
changeSlug: false
changeStatus: false

content:
sections:
fields:
type: fields
fields:
text:
type: textarea
size: huge
fields:
text:
type: textarea
size: huge
28 changes: 9 additions & 19 deletions site/blueprints/pages/home.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
title: Homepage
icon: 🏠
icon: home

options:
create: false
delete: false
duplicate: false
changeSlug: false
changeStatus: false

tabs:
content:
columns:
main:
width: 2/3
sections:
fields:
type: fields
fields:
text:
type: textarea
size: huge
sidebar:
width: 1/3
sections:
pages:
type: pages
template: default
files:
type: files
icon: dashboard
fields:
text:
type: blocks

seotab: seo
11 changes: 11 additions & 0 deletions site/blueprints/sections/articles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type: pages
label: Articles
parent: kirby.page("articles")
info: "{{ page.published }}"
template: article
empty: No articles yet
sortBy: date desc
image:
query: page.cover
cover: true
ratio: 3/2
28 changes: 23 additions & 5 deletions site/blueprints/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,34 @@ title: Site

tabs:
content:
icon: dashboard
columns:
- width: 1/2
- width: 2/3
sections:
singles:
pages:
label: Pages
type: pages
search: true
create: default
templates: default
limit: 25
- width: 1/3
sections:
singles:
type: pages
create: false
sortable: false
sortBy: "title desc"
empty: Please contact admin
templates:
- home
- error
- width: 1/2
sections:

articles:
extends: sections/articles
label: Latest Articles
create: article
status: all
templates: article
sortable: false
max: 20
seotab: seo
7 changes: 6 additions & 1 deletion site/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

return [
'hooks' => [],
'routes' => [],
'routes' => [
[
'pattern' => 'articles',
'action' => fn () => false
]
],
'cache' => [
'pages' => [
'active' => true,
Expand Down
Binary file modified site/logs/retour/log.sqlite
Binary file not shown.

0 comments on commit 4f38aa1

Please sign in to comment.