alleyinteractive / alleyinteractive/alley-scripts
Add a "render-feed.php" file to new blocks
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 3
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 2
Description
### Description
I would like to see a secondary render file created to allow block developers to differentiate the view of a block based on where that block is rendered, whether in content, or in an RSS feed, for example.
I imagine this structure like so:
- Attributes are processed in the `render.php` as they are currently.
- A check is put in place in `render.php` that checks if the loaded page is a feed.
- If so, we load the `render-feed.php` file and return.
- If not, we load the `render-default.php` file and return.
- If additional views are added in the future, their checks can be added to the `render.php` file, and new `render-[service].php` files can be added.
### Use Case
Sometimes we create blocks that are really placeholders for React apps. When this happens, these blocks will only render the React root element in the feed, but will obviously not render the React app in feed viewers, due to no client JS being executed.
This secondary file allows us to pre-define a layout for the block to show in feeds that is appropriate. Beyond that, it will provide a standardized example of adding additional views for things like Apple News feeds, etc.
Contributor guide
Assessment
This issue has not been assessed yet.