TIP: How to detect wasted/unuse Components in StoryBlok

lockevn
2 min readJan 17, 2019

--

Storyblok is the API based & Headless CMS. It has a really good, clean and structured JSON for you as developer and a CMS with truevisual preview.

Basically, editor will create content. Developers create content type (here we call Component) freely. Because we gave “free” to developers, they might create a lot, and introduce wasted.

Storyblok does not (???) have a good way to find and delete those wasted components, so here is my approach:

  • Get all story via REST API (use Postman or Firefox)

https://api.storyblok.com/v1/cdn/stories?token=YOUR_API_TOKEN_HERE_fZLadiRvwtt

  • Copy your response (all stories JSON) to paste to text editor (I use Sublime Text)
  • Reformat the response (easier to read)
  • Search for "components: "
  • Then select all occurences (Alt-Enter, then Home, Shift-End)
  • Cut all occurences and paste to the editor (Ctrl-X, Ctrl-V)
  • Select menu: `Edit / Permute lines / Unique`

==> now we have a list of “inuse Components”

Go to your space to delete unuse components http://app.storyblok.com/#!/me/spaces/SPACEID/components

--

--

lockevn
lockevn

Written by lockevn

Developer, Sportman. Write code with joy, bake app with heart. Opinions are my own. If you feel I save your time, go http://BuyMeACoff.ee/Lockevn

No responses yet