Custom content types do not work
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 248
- Forks
- 752
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 8
Description
Environment
grav 1.5.10 edit: same on 1.6.8
php 7.2
Description
The tutorial states that a custom defined media in media.yaml can be rendered with a custom twig file like *.ical.twig.
It does not work for 'ical' so I tested a true custom content type:
abc:
type: file
thumb: media/thumb.png
mime: text/abc
The according twig template is *.abc.twig.
Observation
After creating twig template and cleaning cache it does not work as expected.
The page trows a '404 page not found' error at system/src/Grav/Common/Processors/PagesProcessor.php.
The exact same twig file renamed to *.json.twig works, but with wrong mime header.
example.html -> work
example.abc -> do not work
example.json -> work
Questions
Maybe a additional file has to be changed? Hard coded '.html' and '.json'?
Reference
https://learn.getgrav.org/16/content/content-types
Maybe relevant #1818
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the content-types tutorial and its media.yaml example, then inspect system/src/Grav/Common/Processors/PagesProcessor.php, which the report identifies as producing the 404. Reproduce the reported behavior for the ical or abc template after clearing cache and compare it with the working json case. Done means the documented custom content-type behavior is verified and the needed documentation or issue reference is clearly identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100