I really enjoy using dynamic collections to build static sites. For example, on a “Team” page there are many team members. It’s easy to manage team members via the dynamic collection UI, and style them once using a dynamic list. It is WAY easier for prototyping than copying/pasting elements because to make visual changes you can just make them once and they are updated for all collection items. However, when I export the site as static assets these dynamic lists are sadly gone.
I’m not the only one that enjoys this workflow, e.g.
I’ve built a Python script that replaces the sad, empty lists on your exported code with the content of your published site, so that this workflow can be accomplished. It doesn’t export links to collection pages for individual items in a collection (although it is 100% possible), so any links to collection pages will be broken. But if you use it like I do, where you just use dynamic lists for ease of use and organizing content, this should suit you fine.
Here is an example site I’ve set up:
When I export it, I get this:
Here is an export ZIP of the site:
Here is the Python script:
If you unzip the exported code and open
index.html, you’ll see that despite the content on my published site, what Webflow exports is blank:
If you save the
webflow-dynamic-list.py script inside the unzipped folder, you can run it like so:
python webflow-dynamic-list.py http://noahs-exceptional-site.webflow.io
The URL you pass in tells the script where to fetch the dynamic data from, so obviously your site should have the latest content published. Don’t forget to swap out my site URL above in the command for your own. This also works with password-protected sites.
The script should run and inject the dynamic content into your local files:
After that, if you re-open
index.html you’ll see the site has your dynamic content!
So the script is pretty basic in that it only handles images, background images, and text. It doesn’t handle collection detail templates (but again, 100% possible). But even with this alone it’s managed to be very handy and makes Webflow a lot more useful to me!