getpelican / pelican-themes

Themes for Pelican
https://getpelican.com/
2.12k stars 1.09k forks source link

Alternate themes preview using Github Pages #740

Closed maphew closed 1 year ago

maphew commented 1 year ago

Building on the proof of concept outlined in #731 I've created a pelican-themes-preview repository that generates a static site for each of the themes in the getpelican/pelican-themes repo (that aren't broken) and publishes them to Github Pages. There's an Action defined that builds and publishes the site when a PR is merged to main branch.

It's a dumb brute force approach and takes up to 10 minutes to complete. An obvious improvement would be to only regenerate the folder tree for the particular theme(s) being updated in the PR instead of all of them all the time. (I don't know how to do that. Hopefully someone else here does?)

Results: https://maphew.github.io/pelican-themes-preview/ Repo: https://github.com/maphew/pelican-themes-preview/

I'm happy to transfer ownership of the repo to the Getpelican organization so that it doesn't become yet another 3rd party dependency in the wings.

Screenshot of 4 of the working resultant themes:

image

maphew commented 1 year ago

For my purposes this is feature complete, though some tuning could be done on the sample content so that there is more coverage of the various text and image types theme developers will want to apply styles to.

I'm not issuing a PR to merge into here because it's not clear to me what the cleanest way to do that is (so the preview and sample content isn't confused for themes themselves). However I'm willing to do that work if there is interest.

Leaving open because as long as the old preview site is broken this should remain visible.

maphew commented 1 year ago

An image gallery of the themes that worked: https://imgur.com/gallery/cL2HI2e. Not part of the preview site yet because I'm having trouble getting headless browser to work inside Github codespaces/actions machines.

JoshuaAdrianJones commented 1 year ago

@maphew This is excellent because http://www.pelicanthemes.com/ is still dead for me today, thank you!

bittner commented 1 year ago

This is excellent!

I'm happy to transfer ownership of the repo to the Getpelican organization so that it doesn't become yet another 3rd party dependency in the wings.

@justinmayer Would you be okay with that?

We could then continue to work on performance optimization (as mentioned by @maphew) and add an overview page with a preview gallery and labels to filter the themes. I don't remember how the broken preview site looked like recently (i.e. if those features were already there), so hopefully this suggestion doesn't offend anyone. :pray:

For filtering I only have the Static Site Generators website as an example. We might be able to do better.

avaris commented 1 year ago

This is nice.

I'm not issuing a PR to merge into here because it's not clear to me what the cleanest way to do that is (so the preview and sample content isn't confused for themes themselves). However I'm willing to do that work if there is interest.

We can maaaybe use github actions to create the preview site under this repo.

maphew commented 1 year ago

I'm not issuing a PR to merge into here because it's not clear to me what the cleanest way to do that is (so the preview and sample content isn't confused for themes themselves). However I'm willing to do that work if there is interest.

We can maaaybe use github actions to create the preview site under this repo.

I tried and failed using GH actions to create previews in my repo, the process would get axed because of over memory or cpu consumption. However I recently learned of Simon Willison's shot-scraper tool which looks promising, https://github.com/maphew/pelican-themes-preview/issues/6

avaris commented 1 year ago

High cpu/memory was from generating the screenshots, I assume? I don't know if it is necessary. Worst case, we can put sites in an index inside iframes instead of screenshots :).

maphew commented 1 year ago

High cpu/memory was from generating the screenshots, I assume? I don't know if it is necessary. Worst case, we can put sites in an index inside iframes instead of screenshots :).

Solved! Simon's shot-scraper works brilliantly.

avaris commented 1 year ago

@maphew Heavily inspired by your efforts, I gave it a try to build preview site under my fork, works quite fine: https://avaris.github.io/pelican-themes/

I'll try integrating taking screenshots and adding it to the index next... when I get more time :).

avaris commented 1 year ago

Screenshots are added as well, again thanks to your work @maphew. I need to cleanup the script and add some error checking in case someone wants to run that locally, but this turned out quite nice :).

Edit: Some submodule themes (e.g. alchemy) are behaving like "packages". Actual theme is inside a folder within the theme folder. Even though they appear to run successfully, they are not properly generated. I need to look into that.

maphew commented 1 year ago

that looks great @avaris, and thanks for uncovering what is going on with alchemy and friends.

justinmayer commented 1 year ago

https://pelicanthemes.com is now back up. Many thanks to @maphew and @avaris for their work on this! 🎊

maphew commented 1 year ago

This is great news! I'm happy to have helped nudge the endeavour forward. :)