Skip to content

Commit

Permalink
updated to Craft 4 and entrified categories
Browse files Browse the repository at this point in the history
  • Loading branch information
CreateSean committed Mar 11, 2023
1 parent ded6c75 commit 7d19908
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
defaultPlacement: end
fieldLayouts:
33ffecde-4b2e-4645-ad54-3c15b2967fcc:
b3390d68-f84f-46fa-9b06-88b3dc039727:
tabs:
-
elementCondition: null
elements:
-
autocapitalize: true
autocomplete: false
autocorrect: true
class: null
disabled: false
elementCondition: null
id: null
instructions: null
label: null
Expand All @@ -25,22 +26,18 @@ fieldLayouts:
tip: null
title: null
type: craft\fieldlayoutelements\TitleField
uid: 593fe1e3-cd73-4c6a-9895-efd6001cd477
uid: a9b04cad-9f4c-4de5-b25a-39852ba6691e
userCondition: null
warning: null
width: 100
name: Content
uid: 674ed069-566a-4ed5-9ba5-eb80d42f9366
handle: newsCategories
name: 'News Categories'
siteSettings:
1a78d395-d81a-4b77-8da7-30a49123bbee: # English
hasUrls: true
template: pages/_news-category.twig
uriFormat: 'news/category/{slug}'
b9fdef79-5b63-4932-a9aa-8d18f937e6d9: # Français
hasUrls: true
template: pages/_news-category.twig
uriFormat: 'news/category/{slug}'
structure:
maxLevels: null
uid: a23aa2ea-1f11-4fd2-b2ea-e420d27e959d
uid: 14887279-63d4-41f5-880f-5923f8d02a1d
userCondition: null
handle: default
hasTitleField: true
name: Default
section: 4b342e70-0223-4c29-9237-86a023f74f1b # News Categories
sortOrder: 1
titleFormat: null
titleTranslationKeyFormat: null
titleTranslationMethod: site
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@ instructions: null
name: 'News Categories'
searchable: false
settings:
allowLimit: false
allowMultipleSources: false
allowSelfRelations: false
branchLimit: null
localizeRelations: true
maintainHierarchy: true
maxRelations: null
minRelations: null
selectionLabel: null
showSiteMenu: false
source: 'group:d59f931d-37a7-4cb9-ac6b-68e0bb987ad2' # News Categories
sources: '*'
sources:
- 'section:4b342e70-0223-4c29-9237-86a023f74f1b' # News Categories
targetSiteId: null
validateRelatedElements: false
viewMode: null
translationKeyFormat: null
translationMethod: site
type: craft\fields\Categories
type: craft\fields\Entries
19 changes: 16 additions & 3 deletions config/project/project.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dateModified: 1678476674
dateModified: 1678539015
elementSources:
craft\elements\Entry:
-
Expand Down Expand Up @@ -28,7 +28,16 @@ elementSources:
- link
type: native
-
defaultSort:
- postDate
- desc
disabled: false
key: 'section:ce27286a-7635-4494-9c9c-77f2d73352f4' # Fragments
tableAttributes:
- postDate
- expiryDate
- author
- link
type: native
-
heading: ''
Expand All @@ -43,8 +52,11 @@ elementSources:
key: 'section:0784ad32-f952-40b1-9f6c-d0e67d502551' # User Guide
type: native
-
heading: ''
heading: Categories
type: heading
-
key: 'section:4b342e70-0223-4c29-9237-86a023f74f1b' # News Categories
type: native
email:
fromEmail: $SYSTEM_EMAIL
fromName: $SENDER_NAME
Expand Down Expand Up @@ -81,6 +93,7 @@ meta:
2b01b0d7-0c08-4e47-8041-e2b6a7fc855b: Caption # Caption
2fcd48d2-b2b1-479f-9015-016904e4eab4: 'Craft Starter' # Craft Starter
3b9496a7-4539-4c28-91bc-3e51c68f4187: Embed # Embed
4b342e70-0223-4c29-9237-86a023f74f1b: 'News Categories' # News Categories
4d4435a9-cff2-46e6-9e43-ca2b7d62486f: Button # Button
5bca37e0-a30f-48fd-9fde-3105fb9d9738: 'Notice Bar' # Notice Bar
5bed279a-5360-4e96-b92e-3153c98bff40: 'Section Title' # Section Title
Expand Down Expand Up @@ -156,7 +169,6 @@ meta:
cf771399-6f67-4917-bd2f-0173c3504c7e: Padding # Padding
d5f8da04-ca55-4c9f-8605-e7f8779e82b8: Image # Image
d19b4314-0267-4e95-9e63-2462a334eea1: 'User Guide' # User Guide
d59f931d-37a7-4cb9-ac6b-68e0bb987ad2: 'News Categories' # News Categories
d974bf8d-647d-45f3-98be-0733d5e3e1ba: 'User Guide' # User Guide
d1511275-c802-4850-9b74-6e305f2cc1c7: 'Asset Fields' # Asset Fields
da3d7ec4-1d85-47ba-a517-6c81d94cc9d2: Copy # Copy
Expand All @@ -165,6 +177,7 @@ meta:
e285fc8c-8b64-4829-afe0-88f9d0c3c8c4: 'Section Title' # Section Title
ea7fe716-adee-4200-a8ca-15362418cd97: Home # Home
ef8cc244-dfa8-41b1-945d-cb673ae71824: Common # Common
ef488e30-b35e-4bf8-87a3-34f0f76b622f: Default # Default
f03239f9-af65-481a-b6b8-76e0e158244f: Caption # Caption
f4da8483-be1a-439d-8918-afde0ea14454: Text # Text
f90a85bd-91b2-462b-acb4-8f265ded647e: Copy # Copy
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
defaultPlacement: end
enableVersioning: true
handle: newsCategories
name: 'News Categories'
previewTargets:
-
__assoc__:
-
- label
- 'Primary entry page'
-
- urlFormat
- '{url}'
propagationMethod: all
siteSettings:
1a78d395-d81a-4b77-8da7-30a49123bbee: # English
enabledByDefault: true
hasUrls: true
template: pages/_news-category.twig
uriFormat: 'news/category/{slug}'
b9fdef79-5b63-4932-a9aa-8d18f937e6d9: # Français
enabledByDefault: true
hasUrls: true
template: pages/_news-category.twig
uriFormat: 'news/category/{slug}'
structure:
maxLevels: null
uid: 6defae27-bbfa-4841-9096-f69c8b9f8e75
type: structure
Binary file modified db.sql.gz
Binary file not shown.
3 changes: 1 addition & 2 deletions templates/_components/news-listing.twig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{% set params = { section: 'news', limit: limit } %}

{# filter by category if on category page #}
{% set blogCategory = craft.categories.slug(category).one() %}
{% set blogCategory = craft.entries.slug(category).one() %}
{% if category != '' %}
{% set params = params | merge({ relatedTo: blogCategory }) %}
{% endif %}
Expand All @@ -27,7 +27,6 @@
{% set pageInfo = sprig.paginate(entryQuery, page) %}
{% set entries = pageInfo.pageResults %}


<section class="py-8 bg-gray-50">
<div class="container">
<div class="grid w-full grid-cols-1 gap-8 lg:grid-cols-2">
Expand Down

0 comments on commit 7d19908

Please sign in to comment.