-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add a package that provides a publications feature #685
Conversation
Codecov Report
@@ Coverage Diff @@
## master #685 +/- ##
===========================================
Coverage 99.97% 99.97%
- Complexity 2678 3388 +710
===========================================
Files 304 360 +56
Lines 6978 9164 +2186
===========================================
+ Hits 6976 9162 +2186
Misses 2 2
|
Are list and detail the best names for templates? Maybe we should match Laravel and use show and index? Edit: List and detail are probably best for now. |
From Robert RE: Generate list and detail pages when creating publication types
|
packages/framework/src/Framework/Features/Publications/PublicationService.php
Outdated
Show resolved
Hide resolved
Generated pubtype field names should be lower/kebab case Done: they are converted via Str::slug() |
Some notes for me to circle back on later(tm) Update: All resolved |
Generated PublicationFieldType field names should be lower/kebab case to match the constructor normalization made in the PublicationFieldType class _Originally posted by @caendesilva in #685 (comment)
c402990
to
47b44c6
Compare
GitHub Copilot gave me an idea. What if instead of a schema.json for publications, we actually generate a PHP class? That would ensure direct type safety and reduce parsing. Something to experiment with maybe? |
I also want to make the publications source root configurable, for example by having them all in a publications/ directory. |
So:
|
1: Thanks for your thoughts, it was just a random idea I had, but you're right, JSON is probably easier. 2: Right, my sleepy brain forgot about that! |
Oh sorting out some composer merge conflicts, I'm reminded, we probably should move |
RE: f87dac1 We might want to show index (list) pages in navigation. Idea for later... Edit: Could also be something to put in the schema |
packages/framework/src/Framework/Features/Publications/PublicationService.php
Outdated
Show resolved
Hide resolved
Originally posted by @caendesilva in #765 (comment) |
While the package is not done, I think I will soon merge this as the size of this PR is so massive, it will help the polishing phase to be more granular. |
About
Publication pages adds an easy way to create custom no-code page types, with support using a custom front matter schema and Blade templates. This feature is in development at the HydePHP develop monorepository, #685, and will be published as an official HydePHP extension tied to HydePHP v1.0.
Thank you to @rgasch for suggesting and implementing this feature in #667!
Tasks before merge:
General
Pull Requests
Issues
Comments
Ideas/Bugs/Other
validation.required
Updates to the make:publication command #786
php hyde make:publication foo
and there are no publications at all, the current message"Error: Unable to locate any publication types. Did you create any?"
might not be entirely relevant.Narrow scope of PR
Design questions to confer with rgasch
Documentation (draft)
Publications
Introduction
Publication pages adds an easy way to create custom no-code page types, with support using a custom front matter schema and Blade templates.
Creating your first publication type
Overview
Publication types provide the rules and structure for the publication pages within. At their core, a publication type is just a JSON schema file in a top-level directory of your HydePHP project. When adding publication pages, you put the Markdown files in that directory, along with any [#templates] you want to use for compiling them.
Getting started
It could not be simpler to get started! All you need to do is enter the
php hyde make:publicationType
command in your terminal, and you will be asked to fill in details in the interactive prompt.[img]
Once done, the command will generate a new directory based on the selected name, as well as a few files:
schema.json - This file defines information for Hyde on how to render your publications, as well as the front matter types used by the pages.
list.blade.php - This file will be used when rendering the index page (or pages if you enabled pagination)
detail.blade.php - This file is used to render a single publication page
Creating publication pages
Overview
Publication pages are nothing more than Markdown files in your publication’s directory. They function very similarly to [#blog posts] and [#Markdown pages] and can even be scaffolded the same way
Features
Pagination…
Validation…