UWCS / stardust

New website from 23/24 using Zola
https://uwcs.co.uk
1 stars 4 forks source link

Improve CMS Editor #59

Open ericthelemur opened 7 months ago

ericthelemur commented 7 months ago

Decap allows for custom widgets to pick fields, which would be a lot nicer than the current layout. In fact, there was one for categories & tags that I never got time to add back after a Decap update that required converting the widgets from class components to functional components.

Fields that should have a custom widget:

The formatting of the preview could 100% be improved, loading custom CSS is easy, currently only loading the basics in the macro parts::preview_styles

Decap docs here https://decapcms.org/docs/custom-widgets/, code for the old one is here https://github.com/UWCS/stardust/blob/80ae7b2c193b113a533e1d29ad87dc3edd5fcc67/templates/admin/admin.html#L21-L63 and used here https://github.com/UWCS/stardust/blob/80ae7b2c193b113a533e1d29ad87dc3edd5fcc67/templates/admin/config.html#L35

ericthelemur commented 7 months ago

Oh also, the short codes (such as {{ note(...) }} render on the actual page, but are currently disabled in the preview. See issue https://github.com/UWCS/stardust/issues/5

I had this working for basic shortcodes (no ifs, etc.) by using the shortcode in admin/_index.md and generating a wrapping -- hoping this meant the shortcodes wouldn't have to be defined twice. But that's unlikely, unless there is some third format we can get both JS and Zola to understand. So probably just gonna have to commit to duplicating shortcodes in JS and Zola,

See decap docs https://decapcms.org/docs/customization/ and the current wrapper top and bottom and used like https://github.com/UWCS/stardust/blob/master/content/admin/_index.md