Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Craft 5.x #213

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b28dea4
Update test images and DDEV config for Craft 5
AugustMiller Feb 20, 2024
bd19fdb
Update Craft, remove Typogrify
AugustMiller Feb 20, 2024
20399e5
DDEV: Use PHP 8.2
AugustMiller Feb 20, 2024
d1ac837
Update to Craft 5, switch to CKEditor and Twigpack
AugustMiller Feb 20, 2024
323d871
Correct manifest paths
AugustMiller Feb 20, 2024
348ff3a
Gatsby config
AugustMiller Feb 20, 2024
95e228f
More Gatsby config
AugustMiller Feb 21, 2024
36c6242
Update migration for Craft 5, fix `safeDown`
AugustMiller Feb 21, 2024
2eecff4
Replace AssetRev with Twigpack in Readme
AugustMiller Feb 22, 2024
5fcd415
Update schema permissions
AugustMiller Feb 22, 2024
a70a504
Gatsby GraphQL changes for Matrix entrification
AugustMiller Feb 22, 2024
74019d9
Bind all interfaces for DDEV
AugustMiller Feb 22, 2024
800f7bd
Rebuild assets
AugustMiller Feb 22, 2024
934dff7
Ignore VS Code config + license.key
AugustMiller Feb 22, 2024
9e78076
PHP 8.2 for test matrix and nginx image, Setup action update
AugustMiller Feb 22, 2024
f41a0d4
Remove assetrev from Project Config
AugustMiller Feb 22, 2024
ad3cf12
Remove Redactor from Project Config
AugustMiller Feb 22, 2024
42ef62a
Remove Gatsby from test workflow/action
AugustMiller Feb 22, 2024
33b48e8
New Twigpack remote
AugustMiller Feb 22, 2024
0dd33af
User settings
AugustMiller Feb 22, 2024
1a81210
Post-upgrade field cleanup
AugustMiller May 11, 2024
ac4661f
Update to Craft 5.1.2
AugustMiller May 11, 2024
49afde8
Bump schema version
AugustMiller Jul 12, 2024
4d6674c
Update Craft + schema version
AugustMiller Aug 12, 2024
bda998b
Update Craft
AugustMiller Nov 21, 2024
1525e30
Merge branch 'main' into v5
AugustMiller Nov 26, 2024
937645b
upload-artifact@v2 => v4
angrybrad Jan 7, 2025
537c6fc
Update to Craft 5.6.0
AugustMiller Jan 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .ddev/config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: starter-blog
type: craftcms
docroot: web
php_version: "8.1"
php_version: "8.2"
webserver_type: nginx-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
database:
type: mariadb
version: "10.4"
type: mysql
version: "8.0"
nfs_mount_enabled: false
mutagen_enabled: false
use_dns_when_possible: true
@@ -229,6 +229,10 @@ web_extra_exposed_ports:
container_port: 3000
http_port: 2999
https_port: 3000
- name: gatsby
container_port: 8000
http_port: 7999
https_port: 8000

#web_extra_daemons:
#- name: "http-1"
5 changes: 3 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -27,5 +27,6 @@ DISALLOW_ROBOTS=true

# Read about Gatsby preview + build hooks:
# -> https://www.gatsbyjs.com/docs/reference/cloud/build-and-preview-webhooks/
GATSBY_PREVIEW_TARGET="@web:8000/__refresh"
# GATSBY_BUILD_TARGET="https://webhook.gatsbyjs.com/hooks/data_source/publish/site-id"
GATSBY_REFRESH_URL="https://starter-blog.ddev.site:8000/__refresh"
GATSBY_PREVIEW_URL="https://starter-blog.ddev.site:8000"
GATSBY_BUILD_TARGET="https://webhook.gatsbyjs.com/hooks/data_source/publish/site-id"
2 changes: 0 additions & 2 deletions .github/workflows/.env-gatsby

This file was deleted.

28 changes: 9 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -11,17 +11,17 @@ permissions:
contents: read
jobs:
test:
name: Gatsby + Craft with PHP ${{ matrix.php-versions }} + ${{ matrix.db }}
name: Craft on PHP ${{ matrix.php-versions }} + ${{ matrix.db }}
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ["8.0", "8.1"]
php-versions: ["8.2"]
db: ["mysql", "pgsql"]

services:
mysql:
image: mysql:5.7
image: mysql:8.0
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: root
@@ -30,7 +30,7 @@ jobs:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:12
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
@@ -39,7 +39,7 @@ jobs:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
nginx:
image: craftcms/nginx:8.0
image: craftcms/nginx:8.2
options: --volume ${{ github.workspace }}:/app --user www-data:www-data
ports:
- 80:8080
@@ -48,7 +48,7 @@ jobs:
- uses: actions/checkout@v2

- name: Setup PHP Action
uses: shivammathur/setup-php@2.5.0
uses: shivammathur/setup-php@2.29.0
with:
php-version: ${{ matrix.php-versions }}
extensions: bcmath, mbstring, intl, gd, imagick, zip, dom, pdo_mysql, pdo_pgsql, fileinfo
@@ -63,7 +63,7 @@ jobs:

- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress

- name: Add Docker database host aliases to build environment
run: sudo echo "127.0.0.1 nginx postgres mysql" | sudo tee -a /etc/hosts

@@ -76,23 +76,13 @@ jobs:
- name: Set Craft writable folder permissions
run: chmod -R 777 config storage web/cpresources

# This project is used for schema introspection, so we do need to know that the API is healthy:
- name: Ping GraphQL endpoint
run: |-
curl -s -X POST -H "Content-Type: application/json" --data '{ "query": "{ ping }" }' http://nginx/api

- name: Prepare Gatsby environment
run: cp .github/workflows/.env-gatsby headless-front-end/gatsby/.env

- name: Install Gatsby dependencies
run: npm install && npm install gatsby-cli
working-directory: headless-front-end/gatsby

- name: Build Gatsby site
run: npm run build
working-directory: headless-front-end/gatsby

- name: Upload Craft logs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: craft-logs
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/.env
/.idea
/.vscode
/vendor
/node_modules
.DS_Store
*.code-workspace
*.code-workspace

/config/license.*
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -326,18 +326,19 @@ We hope you’ll give it a go, but if you prefer not to, then delete these folde
* `package.json`
* `package-lock.json`

In the `templates/layout/main.twig` find this:
In the `templates/_private/layout/index.twig` file, remove these lines, in the `<head>` and at the end of `<body>`, respectively:

```twig
{% set stylesheet = rev('main.css') %}
{% if stylesheet %}
<link rel="stylesheet" href="{{ rev('main.css') }}">
{% endif %}
{{ craft.twigpack.includeCssModule("main.css") }}

{# ... #}

{{ craft.twigpack.includeJsModule("main.js") }}
```

Replace it with a link to your own stylesheet.
with a `<link>` for your own stylesheet!

You can also safely uninstall and remove the Asset Rev plugin from the Control Panel (and delete the `config/assetrev.php` file).
You can also safely uninstall and remove the [Twigpack](https://plugins.craftcms.com/twigpack) plugin from the Control Panel (and delete the `config/twigpack.php` file).

### Setup

10 changes: 3 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -4,11 +4,10 @@
"type": "project",
"license": "0BSD",
"require": {
"clubstudioltd/craft-asset-rev": "^7.0.0",
"craftcms/cms": "^4.5.4",
"craftcms/cms": "^5.0.0",
"craftcms/gatsby-helper": "^2.0.0",
"craftcms/redactor": "^3.0.0",
"nystudio107/craft-typogrify": "^4.0.0",
"craftcms/ckeditor": "^4.0.0",
"nystudio107/craft-twigpack": "^5.0.0",
"vlucas/phpdotenv": "^5.4.0"
},
"autoload": {
@@ -19,9 +18,6 @@
"config": {
"sort-packages": true,
"optimize-autoloader": true,
"platform": {
"php": "8.0.2"
},
"allow-plugins": {
"yiisoft/yii2-composer": true,
"craftcms/plugin-installer": true
4,796 changes: 2,652 additions & 2,144 deletions composer.lock

Large diffs are not rendered by default.

24 changes: 0 additions & 24 deletions config/assetrev.php

This file was deleted.

1 change: 1 addition & 0 deletions config/general.php
Original file line number Diff line number Diff line change
@@ -25,5 +25,6 @@
->aliases([
'@web' => App::env('PRIMARY_SITE_URL'),
'@webroot' => '@root/web',
'@gatsby' => App::env('GATSBY_PREVIEW_URL'),
])
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
headingLevels:
- 1
- 2
- 3
- 4
- 5
- 6
name: Default
options:
code:
indentSequence: ' '
toolbar:
- sourceEditing
- '|'
- heading
- '|'
- blockQuote
- codeBlock
- bold
- italic
- strikethrough
- bulletedList
- numberedList
- insertImage
- link
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
headingLevels:
- 1
- 2
- 3
- 4
- 5
- 6
name: 'Simple 2'
options:
code:
indentSequence: ' '
toolbar:
- bold
- italic
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
headingLevels:
- 1
- 2
- 3
- 4
- 5
- 6
name: Standard
options:
code:
indentSequence: ' '
toolbar:
- heading
- '|'
- blockQuote
- codeBlock
- bold
- italic
- bulletedList
- numberedList
- link
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
headingLevels:
- 1
- 2
- 3
- 4
- 5
- 6
name: Simple
toolbar:
- heading
- '|'
- bold
- italic
- link
Original file line number Diff line number Diff line change
@@ -16,6 +16,5 @@ fieldLayouts:
handle: about
hasTitleField: false
name: About
section: 5a80053a-6435-4fd2-8a47-53e409d994ad # About
sortOrder: 1
titleFormat: '{section.name|raw}'
Original file line number Diff line number Diff line change
@@ -58,7 +58,6 @@ fieldLayouts:
handle: blog
hasTitleField: true
name: Blog
section: db2dff45-19b4-479c-8cba-ab88e7e7d2fd # Blog
sortOrder: 1
titleFormat: null
titleTranslationKeyFormat: null
Original file line number Diff line number Diff line change
@@ -16,6 +16,5 @@ fieldLayouts:
handle: home
hasTitleField: false
name: Home
section: 4593234a-cdd0-4c54-9931-4eb606b9e7f5 # Home
sortOrder: 1
titleFormat: '{section.name|raw}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
color: null
fieldLayouts:
d0baa120-b528-4317-a11e-0a36f80501c3:
tabs:
-
elementCondition: null
elements:
-
elementCondition: null
fieldUid: 6b203fd7-eca1-4313-8795-efbb5f6a8e63 # Image
handle: null
includeInCards: false
instructions: null
label: Image
providesThumbs: true
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: a1ad0bac-ef1a-475f-96dc-2ae14f2766f1
userCondition: null
warning: null
width: 100
-
elementCondition: null
fieldUid: 5d2372e2-c220-4af4-80c9-49bb8c85a92e # Position
handle: null
includeInCards: true
instructions: null
label: Position
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 530b405b-3e1e-4c46-a0c2-e6f0348272d0
userCondition: null
warning: null
width: 100
name: Content
uid: 249743ae-e9a8-41ce-b286-4782bff3be44
userCondition: null
handle: image
hasTitleField: false
icon: null
name: Image
showSlugField: true
showStatusField: true
slugTranslationKeyFormat: null
slugTranslationMethod: site
titleFormat: null
titleTranslationKeyFormat: null
titleTranslationMethod: site
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
color: null
fieldLayouts:
a3b39778-708a-4de0-9501-6b1d37108919:
tabs:
-
elementCondition: null
elements:
-
elementCondition: null
fieldUid: a6f02aa5-ab37-46e2-bbd4-3b56930577d5 # Images
handle: null
includeInCards: false
instructions: null
label: Images
providesThumbs: true
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 943a94ce-7da1-44ac-a419-52001d4822f4
userCondition: null
warning: null
width: 100
-
elementCondition: null
fieldUid: 2f6bf496-df01-42e0-9b77-a764f886813d # Aspect Ratio
handle: null
includeInCards: true
instructions: null
label: 'Aspect Ratio'
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: baea9a3e-739d-4896-bb9c-cc560fac5804
userCondition: null
warning: null
width: 100
name: Content
uid: 5d1c7888-50cf-4d9c-9a2c-4df568eaa1d6
userCondition: null
handle: imageCarousel
hasTitleField: false
icon: null
name: 'Image Carousel'
showSlugField: true
showStatusField: true
slugTranslationKeyFormat: null
slugTranslationMethod: site
titleFormat: null
titleTranslationKeyFormat: null
titleTranslationMethod: site
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
color: null
fieldLayouts:
e25f5116-982d-45a0-ac12-9d3a3f1d07e7:
tabs:
-
elementCondition: null
elements:
-
elementCondition: null
fieldUid: a6ca7d80-fa7f-433b-b6ba-fd9f19791f82 # Style
handle: null
includeInCards: true
instructions: null
label: Style
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 15732e19-4eb6-4f16-9332-e489400b54ac
userCondition: null
warning: null
width: 100
-
elementCondition: null
fieldUid: 09c265f3-2ab1-405d-9111-108e6b54f0fb # Quote
handle: null
includeInCards: false
instructions: null
label: Quote
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 5678bfa2-11ec-410b-8815-df39bc123959
userCondition: null
warning: null
width: 100
-
elementCondition: null
fieldUid: 5fd465cf-5b00-4b4f-8ee0-ce0eac4fd2eb # Attribution
handle: null
includeInCards: false
instructions: null
label: Attribution
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: fdd111e3-5569-49e8-b9a0-2485efee9103
userCondition: null
warning: null
width: 100
name: Content
uid: 62ab037b-3946-4f4b-8f9c-2b62d059c26f
userCondition: null
handle: quote
hasTitleField: false
icon: null
name: Quote
showSlugField: true
showStatusField: true
slugTranslationKeyFormat: null
slugTranslationMethod: site
titleFormat: null
titleTranslationKeyFormat: null
titleTranslationMethod: site
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
color: null
fieldLayouts:
59ffc94b-a1a3-4ecb-98e4-67dbd4317f23:
tabs:
-
elementCondition: null
elements:
-
elementCondition: null
fieldUid: df3a27ff-e318-422f-8ff5-d626eda8ce54 # Rich Text
handle: null
includeInCards: false
instructions: null
label: 'Rich Text'
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 8d3f5d0f-6f0f-46e2-b82e-4bb4a14fe586
userCondition: null
warning: null
width: 100
name: Content
uid: fde4af3d-7f7c-439e-85db-7a3e03c7c093
userCondition: null
handle: richText
hasTitleField: false
icon: null
name: 'Rich Text'
showSlugField: true
showStatusField: true
slugTranslationKeyFormat: null
slugTranslationMethod: site
titleFormat: null
titleTranslationKeyFormat: null
titleTranslationMethod: site

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
columnSuffix: null
handle: aspectRatio
instructions: null
name: 'Body Content - Image Carousel - Aspect Ratio'
searchable: true
settings:
options:
-
__assoc__:
-
- label
- '16:9'
-
- value
- '16:9'
-
- default
- '1'
-
__assoc__:
-
- label
- '4:3'
-
- value
- '4:3'
-
- default
- ''
-
__assoc__:
-
- label
- '3:2'
-
- value
- '3:2'
-
- default
- ''
translationKeyFormat: null
translationMethod: none
type: craft\fields\Dropdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
columnSuffix: null
handle: attribution
instructions: null
name: 'Body Content - Quote - Attribution'
searchable: true
settings:
byteLimit: null
charLimit: null
code: false
initialRows: 4
multiline: false
placeholder: null
uiMode: normal
translationKeyFormat: null
translationMethod: none
type: craft\fields\PlainText
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
columnSuffix: null
contentColumnType: string
fieldGroup: 911477c7-3c92-407b-a9a9-e69ccb74eabb # Common
handle: bodyContent
instructions: ''
name: 'Body Content'
searchable: true
settings:
contentTable: '{{%matrixcontent_bodycontent}}'
maxBlocks: ''
minBlocks: ''
entryTypes:
- 0c98f9b9-84bf-4766-af63-a3568b46c0a6 # Rich Text
- 7e401ee6-3575-42de-b3b4-cedae706f392 # Image Carousel
- 28d5c036-8cb0-4a14-b553-0167ee34efbe # Image
- a121b8e6-70e6-421b-9629-c664d2949934 # Quote
maxEntries: ''
minEntries: ''
propagationKeyFormat: null
propagationMethod: all
viewMode: blocks
translationKeyFormat: null
translationMethod: site
type: craft\fields\Matrix
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
contentColumnType: text
fieldGroup: 911477c7-3c92-407b-a9a9-e69ccb74eabb # Common
handle: caption
instructions: ''
name: Caption
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
columnSuffix: null
handle: image
instructions: 'Double-click the image thumbnail to apply a caption to an image.'
name: 'Body Content - Image - Image'
searchable: true
settings:
allowSelfRelations: false
allowSubfolders: false
allowUploads: true
allowedKinds:
- image
branchLimit: null
defaultUploadLocationSource: 'volume:101a70a1-d200-4629-91e5-3425a0937c0e' # Uploads
defaultUploadLocationSubpath: images
localizeRelations: false
maintainHierarchy: false
maxRelations: 1
minRelations: null
previewMode: full
restrictFiles: true
restrictLocation: false
restrictedDefaultUploadSubpath: null
restrictedLocationSource: 'volume:101a70a1-d200-4629-91e5-3425a0937c0e' # Uploads
restrictedLocationSubpath: null
selectionLabel: 'Add an image'
showCardsInGrid: false
showSiteMenu: true
showUnpermittedFiles: false
showUnpermittedVolumes: true
sources: '*'
targetSiteId: null
validateRelatedElements: false
viewMode: large
translationKeyFormat: null
translationMethod: site
type: craft\fields\Assets
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
contentColumnType: text
fieldGroup: 911477c7-3c92-407b-a9a9-e69ccb74eabb # Common
handle: imageAlt
instructions: 'Optional text for the `<img>` tag `alt` attribute.'
name: 'Image Alt'
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
columnSuffix: null
handle: images
instructions: 'Double-click an image thumbnail to apply a caption to an image.'
name: 'Body Content - Image Carousel - Images'
searchable: true
settings:
allowSelfRelations: false
allowSubfolders: false
allowUploads: true
allowedKinds:
- image
branchLimit: null
defaultUploadLocationSource: 'volume:101a70a1-d200-4629-91e5-3425a0937c0e' # Uploads
defaultUploadLocationSubpath: images
localizeRelations: false
maintainHierarchy: false
maxRelations: null
minRelations: null
previewMode: full
restrictFiles: true
restrictLocation: false
restrictedDefaultUploadSubpath: null
restrictedLocationSource: 'volume:101a70a1-d200-4629-91e5-3425a0937c0e' # Uploads
restrictedLocationSubpath: null
selectionLabel: 'Add an image'
showCardsInGrid: false
showSiteMenu: true
showUnpermittedFiles: false
showUnpermittedVolumes: true
sources: '*'
targetSiteId: null
validateRelatedElements: false
viewMode: large
translationKeyFormat: null
translationMethod: site
type: craft\fields\Assets
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
columnSuffix: null
handle: position
instructions: null
name: 'Body Content - Image - Position'
searchable: true
settings:
options:
-
__assoc__:
-
- label
- Wide
-
- value
- wide
-
- default
- '1'
-
__assoc__:
-
- label
- Center
-
- value
- center
-
- default
- ''
-
__assoc__:
-
- label
- Left
-
- value
- left
-
- default
- ''
-
__assoc__:
-
- label
- Right
-
- value
- right
-
- default
- ''
translationKeyFormat: null
translationMethod: none
type: craft\fields\Dropdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
columnSuffix: null
handle: quote
instructions: null
name: 'Body Content - Quote - Quote'
searchable: true
settings:
availableTransforms: '*'
availableVolumes: '*'
ckeConfig: 7e2c012d-f507-4762-86e3-9b0ddc400c1f # Simple 2
columnType: text
defaultTransform: ''
enableSourceEditingForNonAdmins: true
purifierConfig: ''
purifyHtml: '1'
showUnpermittedFiles: false
showUnpermittedVolumes: true
translationKeyFormat: null
translationMethod: none
type: craft\ckeditor\Field
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
columnSuffix: null
handle: richText
instructions: null
name: 'Body Content - Rich Text - Rich Text'
searchable: true
settings:
availableTransforms: '*'
availableVolumes: '*'
ckeConfig: 913a6b8c-fba7-4a5c-9615-496e1bec6467 # Standard
columnType: text
defaultTransform: ''
enableSourceEditingForNonAdmins: true
purifierConfig: ''
purifyHtml: '1'
showUnpermittedFiles: false
showUnpermittedVolumes: true
translationKeyFormat: null
translationMethod: none
type: craft\ckeditor\Field
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
contentColumnType: text
fieldGroup: 911477c7-3c92-407b-a9a9-e69ccb74eabb # Common
handle: siteIntroduction
instructions: ''
name: 'Site Introduction'
searchable: true
settings:
availableTransforms: '*'
availableVolumes: '*'
cleanupHtml: true
ckeConfig: 69e08c2b-0771-4f37-b3ab-b01ae9535ee0 # Default
columnType: text
enableSourceEditingForNonAdmins: false
purifierConfig: ''
purifyHtml: '1'
redactorConfig: ''
removeEmptyTags: '1'
removeInlineStyles: '1'
removeNbsp: '1'
translationKeyFormat: null
translationMethod: none
type: craft\redactor\Field
type: craft\ckeditor\Field
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
columnSuffix: null
handle: style
instructions: null
name: 'Body Content - Quote - Style'
searchable: true
settings:
options:
-
__assoc__:
-
- label
- Blockquote
-
- value
- blockquote
-
- default
- '1'
-
__assoc__:
-
- label
- Pullquote
-
- value
- pullquote
-
- default
- ''
translationKeyFormat: null
translationMethod: none
type: craft\fields\Dropdown
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
contentColumnType: text
fieldGroup: 911477c7-3c92-407b-a9a9-e69ccb74eabb # Common
handle: summary
instructions: 'Summary for the blog index'
name: Summary
searchable: true
settings:
availableTransforms: '*'
availableVolumes: ''
cleanupHtml: true
ckeConfig: 69e08c2b-0771-4f37-b3ab-b01ae9535ee0 # Default
columnType: text
enableSourceEditingForNonAdmins: false
purifierConfig: ''
purifyHtml: '1'
redactorConfig: ''
removeEmptyTags: '1'
removeInlineStyles: '1'
removeNbsp: '1'
translationKeyFormat: null
translationMethod: none
type: craft\redactor\Field
type: craft\ckeditor\Field
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
isPublic: false
name: Gatsby
scope:
- 'sites.f3400d6f-0f33-4cef-9521-f8f6620399ec:read' # Craft Blog
- 'elements.drafts:read'
- 'elements.revisions:read'
- 'elements.inactive:read'
- 'sections.5a80053a-6435-4fd2-8a47-53e409d994ad:read' # About
- 'entrytypes.dbd1be32-5e0d-4483-92a5-cc47aba67dcc:read' # About
- 'sections.db2dff45-19b4-479c-8cba-ab88e7e7d2fd:read' # Blog
- 'entrytypes.bb6d289b-c3cf-4a8d-9324-b98cbd32753b:read' # Blog
- 'sections.4593234a-cdd0-4c54-9931-4eb606b9e7f5:read' # Home
- 'entrytypes.8518a799-a012-4a6c-aa89-6a347cc00c2e:read' # Home
- 'sections.db2dff45-19b4-479c-8cba-ab88e7e7d2fd:read' # Blog
- 'nestedentryfields.09c265f3-2ab1-405d-9111-108e6b54f0fb:read' # Quote
- 'nestedentryfields.df3a27ff-e318-422f-8ff5-d626eda8ce54:read' # Rich Text
- 'nestedentryfields.031e8547-9981-4367-ad27-178240517ea1:read' # Site Introduction
- 'nestedentryfields.5e76b2e3-1eae-4bbc-93f4-122fe4526b02:read' # Summary
- 'nestedentryfields.e567b6ab-3855-452b-a337-4c119dac4d62:read' # Body Content
- 'volumes.101a70a1-d200-4629-91e5-3425a0937c0e:read' # Uploads
- 'usergroups.everyone:read'
- 'gatsby:read'
- 'elements.drafts:read'
- 'elements.revisions:read'
- 'elements.inactive:read'
- 'sites.f3400d6f-0f33-4cef-9521-f8f6620399ec:read' # Craft Blog
Original file line number Diff line number Diff line change
@@ -65,23 +65,17 @@ fields:
settings:
availableTransforms: '*'
availableVolumes: '*'
ckeConfig: 7e2c012d-f507-4762-86e3-9b0ddc400c1f # Simple 2
columnType: text
configSelectionMode: choose
defaultTransform: ''
manualConfig: ''
enableSourceEditingForNonAdmins: true
purifierConfig: ''
purifyHtml: '1'
redactorConfig: Simple.json
removeEmptyTags: '1'
removeInlineStyles: '1'
removeNbsp: '1'
showHtmlButtonForNonAdmins: '1'
showUnpermittedFiles: false
showUnpermittedVolumes: true
uiMode: enlarged
translationKeyFormat: null
translationMethod: none
type: craft\redactor\Field
type: craft\ckeditor\Field
a6ca7d80-fa7f-433b-b6ba-fd9f19791f82: # Style
columnSuffix: null
contentColumnType: string
Original file line number Diff line number Diff line change
@@ -27,23 +27,17 @@ fields:
settings:
availableTransforms: '*'
availableVolumes: '*'
ckeConfig: 913a6b8c-fba7-4a5c-9615-496e1bec6467 # Standard
columnType: text
configSelectionMode: choose
defaultTransform: ''
manualConfig: ''
enableSourceEditingForNonAdmins: true
purifierConfig: ''
purifyHtml: '1'
redactorConfig: Standard.json
removeEmptyTags: '1'
removeInlineStyles: '1'
removeNbsp: '1'
showHtmlButtonForNonAdmins: '1'
showUnpermittedFiles: false
showUnpermittedVolumes: true
uiMode: enlarged
translationKeyFormat: null
translationMethod: none
type: craft\redactor\Field
type: craft\ckeditor\Field
handle: richText
name: 'Rich Text'
sortOrder: 1
30 changes: 16 additions & 14 deletions config/project/project.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dateModified: 1694724442
dateModified: 1737482468
email:
fromEmail: support@craftcms.com
fromName: 'Craft Blog'
@@ -20,16 +20,18 @@ meta:
5e76b2e3-1eae-4bbc-93f4-122fe4526b02: Summary # Summary
5fd465cf-5b00-4b4f-8ee0-ce0eac4fd2eb: Attribution # Attribution
6b203fd7-eca1-4313-8795-efbb5f6a8e63: Image # Image
7e2c012d-f507-4762-86e3-9b0ddc400c1f: 'Simple 2' # Simple 2
7e401ee6-3575-42de-b3b4-cedae706f392: 'Image Carousel' # Image Carousel
09c265f3-2ab1-405d-9111-108e6b54f0fb: Quote # Quote
28d5c036-8cb0-4a14-b553-0167ee34efbe: Image # Image
031e8547-9981-4367-ad27-178240517ea1: 'Site Introduction' # Site Introduction
55cd92b3-363e-4573-ad2c-04650483ba64: Gatsby # Gatsby
69e08c2b-0771-4f37-b3ab-b01ae9535ee0: Default # Default
90dee5cc-23f1-40ac-ae14-3fa71bebc4dc: 'Craft Blog' # Craft Blog
101a70a1-d200-4629-91e5-3425a0937c0e: Uploads # Uploads
265d76a5-d5a9-4c82-bee4-2f8450aacd0a: 'Public Schema' # Public Schema
913a6b8c-fba7-4a5c-9615-496e1bec6467: Standard # Standard
8518a799-a012-4a6c-aa89-6a347cc00c2e: Home # Home
911477c7-3c92-407b-a9a9-e69ccb74eabb: Common # Common
4593234a-cdd0-4c54-9931-4eb606b9e7f5: Home # Home
a6ca7d80-fa7f-433b-b6ba-fd9f19791f82: Style # Style
a6f02aa5-ab37-46e2-bbd4-3b56930577d5: Images # Images
@@ -40,39 +42,39 @@ meta:
db95de40-4dec-44cc-9d17-bba2223c91cf: 'Image Alt' # Image Alt
dbd1be32-5e0d-4483-92a5-cc47aba67dcc: About # About
df3a27ff-e318-422f-8ff5-d626eda8ce54: 'Rich Text' # Rich Text
e00e1efa-bb86-4ee8-b669-4a726b8a5427: Simple # Simple
e8fdd2ad-6739-4bab-a689-8a422e18a8f4: Embed # Embed
e567b6ab-3855-452b-a337-4c119dac4d62: 'Body Content' # Body Content
f3400d6f-0f33-4cef-9521-f8f6620399ec: 'Craft Blog' # Craft Blog
plugins:
assetrev:
ckeditor:
edition: standard
enabled: true
schemaVersion: 1.0.0
schemaVersion: 3.0.0.0
gatsby-helper:
edition: standard
enabled: true
schemaVersion: 2.0.0
settings:
buildWebhookUrl: ''
previewWebhookUrl: $GATSBY_PREVIEW_TARGET
redactor:
edition: standard
enabled: true
schemaVersion: 2.3.0
typogrify:
buildWebhookUrl: $GATSBY_BUILD_TARGET
previewServerUrl: ''
previewWebhookUrl: $GATSBY_REFRESH_URL
twigpack:
edition: standard
enabled: true
schemaVersion: 1.0.0
system:
edition: pro
live: true
name: 'Craft Blog'
schemaVersion: 4.5.3.0
schemaVersion: 5.6.0.2
timeZone: America/Los_Angeles
users:
allowPublicRegistration: false
deactivateByDefault: false
defaultGroup: null
photoSubpath: ''
defaultGroup: ''
photoSubpath: null
photoVolumeUid: null
require2fa: all
requireEmailVerification: true
validateOnPublicRegistration: false
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
enableVersioning: true
entryTypes:
- dbd1be32-5e0d-4483-92a5-cc47aba67dcc # About
handle: about
name: About
previewTargets:
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
defaultPlacement: end
enableVersioning: true
entryTypes:
- bb6d289b-c3cf-4a8d-9324-b98cbd32753b # Blog
handle: blog
maxAuthors: 1
name: Blog
previewTargets:
-
@@ -20,7 +24,7 @@ previewTargets:
- 'Gatsby entry page'
-
- urlFormat
- 'http://localhost:8000/blog/{slug}'
- '@gatsby/{uri}'
-
- refresh
- ''
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
enableVersioning: true
entryTypes:
- 8518a799-a012-4a6c-aa89-6a347cc00c2e # Home
handle: home
name: Home
previewTargets:
50 changes: 50 additions & 0 deletions config/twigpack.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

use craft\helpers\App;

return [
// Global settings
'*' => [
// If `devMode` is on, use webpack-dev-server to all for HMR (hot module reloading)
'useDevServer' => false,
// Enforce Absolute URLs on includes
'useAbsoluteUrl' => true,
// The JavaScript entry from the manifest.json to inject on Twig error pages
// This can be a string or an array of strings
'errorEntry' => '',
// String to be appended to the cache key
'cacheKeySuffix' => '',
// Manifest file names
'manifest' => [
'legacy' => 'manifest.json',
'modern' => 'manifest.json',
],
// Public server config
'server' => [
'manifestPath' => '@webroot/assets/dist',
// Don't prepend manifest paths with anything else:
'publicPath' => '',
],
// webpack-dev-server config
'devServer' => [
'manifestPath' => App::env('TWIGPACK_MANIFEST_PATH'),
'publicPath' => App::env('TWIGPACK_PUBLIC_PATH'),
],
// Bundle to use with the webpack-dev-server
'devServerBuildType' => 'modern',
// Whether to include a Content Security Policy "nonce" for inline
// CSS or JavaScript. Valid values are 'header' or 'tag' for how the CSP
// should be included. c.f.:
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#Unsafe_inline_script
'cspNonce' => '',
// Local files config
'localFiles' => [
'basePath' => '@webroot/',
],
],
// Development environment
'dev' => [
// If `devMode` is on, use webpack-dev-server to all for HMR (hot module reloading)
'useDevServer' => true,
],
];
3 changes: 3 additions & 0 deletions headless-front-end/README.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,9 @@

This directory is for front-end headless framework implementations for use with GraphQL.

> [WARNING]
> The Gatsby front-end currently works with the development server, but not during builds. We will be retiring it in favor of headless front-ends that use Craft’s GraphQL API, directly.
* Gatsby (React.js) ✅
* Gridsome (Vue.js) 🚧
* More? 🤔
6 changes: 3 additions & 3 deletions headless-front-end/gatsby/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CRAFTGQL_TOKEN = 1CFHS57JCTtYwQk0_2J-lD8dU3ACIfNU
CRAFTGQL_URL = http://starter-blog.test/api
CRAFTGQL_TOKEN="TEST-GRAPHQL-TOKEN"
CRAFTGQL_URL="https://starter-blog.ddev.site/api"

# uncomment the next line if you’ve configured live preview
# ENABLE_GATSBY_REFRESH_ENDPOINT = true
# ENABLE_GATSBY_REFRESH_ENDPOINT = true
2 changes: 1 addition & 1 deletion headless-front-end/gatsby/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ exports.createPages = ({ graphql, actions }) => {
return graphql(
`
query BlogPostsQuery {
blogPosts: allCraftBlogBlogEntry {
blogPosts: allCraftBlogEntry {
nodes {
remoteId
slug
79 changes: 76 additions & 3 deletions headless-front-end/gatsby/package-lock.json
2 changes: 1 addition & 1 deletion headless-front-end/gatsby/package.json
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@
"scripts": {
"clean": "rm -rf .cache",
"build": "gatsby build",
"develop": "gatsby develop",
"develop": "gatsby develop --host=0.0.0.0",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
12 changes: 4 additions & 8 deletions headless-front-end/gatsby/src/components/matrix/index.js
Original file line number Diff line number Diff line change
@@ -40,19 +40,17 @@ const Blocks = ({ blocks }) => {
export default Blocks

export const query = graphql`
fragment RichTextFragment on Craft_bodyContent_richText_BlockType {
fragment RichTextFragment on Craft_richText_Entry {
richText
typeHandle
}
fragment QuoteFragment on Craft_bodyContent_quote_BlockType {
fragment QuoteFragment on Craft_quote_Entry {
style
quote
attribution
typeHandle
}
fragment ImageFragment on Craft_bodyContent_image_BlockType {
fragment ImageFragment on Craft_image_Entry {
image {
url
... on Craft_uploads_Asset {
@@ -61,17 +59,15 @@ export const query = graphql`
}
}
position
typeHandle
}
fragment ImageCarouselFragment on Craft_bodyContent_imageCarousel_BlockType {
fragment ImageCarouselFragment on Craft_imageCarousel_Entry {
images {
url
... on Craft_uploads_Asset {
imageAlt
}
}
aspectRatio
typeHandle
}
`
2 changes: 1 addition & 1 deletion headless-front-end/gatsby/src/pages/about.js
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ import Matrix from "../components/matrix"

export const query = graphql`
query AboutPageQuery {
about: craftAboutAboutEntry {
about: craftAboutEntry {
title
bodyContent {
...RichTextFragment
10 changes: 5 additions & 5 deletions headless-front-end/gatsby/src/templates/blog-post.js
Original file line number Diff line number Diff line change
@@ -9,16 +9,16 @@ import { getPrettyDate, getStandardDate } from "../utils/dates"

export const query = graphql`
query BlogPostQuery($slug: String!) {
entry: craftBlogBlogEntry(slug: { eq: $slug }) {
entry: craftBlogEntry(slug: { eq: $slug }) {
id
remoteId
title
postDate
bodyContent {
...RichTextFragment
...QuoteFragment
...ImageFragment
...ImageCarouselFragment
... RichTextFragment
... QuoteFragment
... ImageFragment
... ImageCarouselFragment
}
}
}
4 changes: 2 additions & 2 deletions headless-front-end/gatsby/src/templates/home.js
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import { getPrettyDate, getStandardDate } from "../utils/dates"

export const query = graphql`
query WhateverQuery($limit: Int, $skip: Int) {
blogPosts: allCraftBlogBlogEntry(limit: $limit, skip: $skip) {
blogPosts: allCraftBlogEntry(limit: $limit, skip: $skip) {
nodes {
title
slug
@@ -14,7 +14,7 @@ export const query = graphql`
}
}
home: craftHomeHomeEntry {
home: craftHomeEntry {
siteIntroduction
}
18 changes: 5 additions & 13 deletions migrations/m210104_175929_sample_content.php
Original file line number Diff line number Diff line change
@@ -112,21 +112,13 @@ public function safeDown(): bool
Craft::$app->getElements()->deleteElement($block);
}

// remove GraphQL token
// Remove GraphQL token + Schema
$graphQlService = Craft::$app->getGql();
$schemas = $graphQlService->getSchemas();
$gatsbySchema = null;
$gatsbyToken = $graphQlService->getTokenByAccessToken($this->gqlToken);

foreach ($schemas as $schema) {
if ($schema->accessToken === $this->gqlToken) {
$gatsbySchema = $schema;
break;
}
}
$graphQlService->deleteTokenById($gatsbyToken->id);

$graphQlService->deleteSchema($gatsbySchema);

return false;
return true;
}

/**
@@ -139,7 +131,7 @@ public function safeDown(): bool
*/
private function addBlogPosts(): bool
{
if (!$section = Craft::$app->getSections()->getSectionByHandle('blog')) {
if (!$section = Craft::$app->getEntries()->getSectionByHandle('blog')) {
echo 'Blog section does not exist.';
return false;
}
19 changes: 6 additions & 13 deletions templates/_private/layout/index.twig
Original file line number Diff line number Diff line change
@@ -27,15 +27,10 @@
<link href="//fonts.googleapis.com/css?family=Work+Sans:600|Quattrocento+Sans:400,400i,700" rel="stylesheet" type="text/css">

{#
The Asset Rev plugin provides this `rev()` Twig function for cache-busting
css and js files. It will return nothing when the webpack dev server is
running because styles are then injected via js.
Because Webpack produces unpredictably-named bundles, we have to lean on
manifest.json to tell us where they live. Twigpack is perfect for this!
#}
{% set stylesheet = rev('main.css') %}
{% if stylesheet %}
<link rel="stylesheet" href="{{ rev('main.css') }}">
{% endif %}

{{ craft.twigpack.includeCssModule("main.css") }}
</head>
<body class="ltr">
<nav class="container mx-auto py-4 px-4" role="navigation" aria-label="Main">
@@ -82,11 +77,9 @@
</footer>

{#
As in the <head> section above, the Asset Rev plugin provides the `rev()`
function to cache-bust the js file. Unlike the CSS <link> tag in the <head>,
this works just fine with the webpack dev server. See the `/config/assetrev.php`
file to see how it is configured.
As in the <head> section above, the Twigpack plugin allows us to output a
URL to the Javascript bundle—even when using the Webpack dev server!
#}
<script src="{{ rev('main.js') }}"></script>
{{ craft.twigpack.includeJsModule("main.js") }}
</body>
</html>
4 changes: 2 additions & 2 deletions templates/_private/matrix/blocks/quote/blockquote.twig
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@
#}
<blockquote class="text-lg text-bold border-l border-gray-700 pl-4 py-2 rich-text text-gray-700 flex flex-col">

{{ block.quote | typogrify }}
{{ block.quote }}

{#
In this conditional we check the string length of the trimmed value just in
case someone accidentally entered only spaces to the field.
#}
{% if block.attribution | trim | length %}
<footer class="text-gray-600 font-sans text-base">
&mdash; {{ block.attribution | typogrify }}
&mdash; {{ block.attribution }}
</footer>
{% endif %}
</blockquote>
4 changes: 2 additions & 2 deletions templates/_private/matrix/blocks/quote/pullquote.twig
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@
#}
<blockquote class="m-8 italic text-2xl text-bold text-center font-serif rich-text text-gray-800">

{{ block.quote | typogrify }}
{{ block.quote }}

{#
In this conditional we check the string length of the trimmed value just in
case someone accidentally entered only spaces to the field.
#}
{% if block.attribution | trim | length %}
<footer class="text-gray-600 font-sans not-italic text-base">
&mdash; {{ block.attribution | typogrify }}
&mdash; {{ block.attribution }}
</footer>
{% endif %}
</blockquote>
5 changes: 0 additions & 5 deletions web/assets/dist/main.4744d99df1a1b9d54cc2.css

This file was deleted.

5 changes: 5 additions & 0 deletions web/assets/dist/main.639731966ecedf929d94.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions web/assets/dist/manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"main.css": "/assets/dist/main.4744d99df1a1b9d54cc2.css",
"main.js": "/assets/dist/main.4744d99df1a1b9d54cc2.js"
"main.css": "/assets/dist/main.639731966ecedf929d94.css",
"main.js": "/assets/dist/main.639731966ecedf929d94.js"
}