Skip to content

Instantly share code, notes, and snippets.

View DominikAngerer's full-sized avatar
🏠
For sure working from somewhere 🤘

DominikAngerer DominikAngerer

🏠
For sure working from somewhere 🤘
View GitHub Profile
@DominikAngerer
DominikAngerer / migration.js
Created November 15, 2018 15:11
migration.js
let story = '';
const resolve = (item) => {
if (typeof item.component !== 'undefined' && item.component == 'markdown') {
if (typeof item.margin_top === 'undefined' || item.margin_top == '') {
item.margin_top = 'no-margin-top'
}
@DominikAngerer
DominikAngerer / storyblok-publish-all-in-folder.js
Last active February 9, 2023 17:18
Storyblok: How to publish all content entries in one folder
// # Install Dependencies: ---------------------------------------------------------------
// npm install storyblok-js-client
// # Execute with: -----------------------------------------------------------------------
// node storyblok-publish-all-in-folder.js
// # Configure: --------------------------------------------------------------------------
// ID of space your folder is located in
const space_id = 51455
@DominikAngerer
DominikAngerer / language-codes.json
Last active September 28, 2021 09:10
Storyblok Language Codes Array
[ { "af":"Afrikaans" },
{ "sq":"Albanian" },
{ "ar":"Arabic" },
{ "ar_dz":"Arabic (Algeria)" },
{ "ar_bh":"Arabic (Bahrain)" },
{ "ar_eg":"Arabic (Egypt)" },
{ "ar_iq":"Arabic (Iraq)" },
{ "ar_jo":"Arabic (Jordan)" },
{ "ar_kw":"Arabic (Kuwait)" },
{ "ar_lb":"Arabic (Lebanon)" },
@DominikAngerer
DominikAngerer / storyblok-custom-field-modal-demo.js
Last active January 17, 2019 21:50
Storyblok: Custom Field Modal Demo
<template>
<div>
<div v-show="!modalIsOpen">
Custom field is in sidebar / not in modal
<button @click=openModal>Open</button>
</div>
<div v-if="modalIsOpen">
Custom field is in not in sidebar but in a modal
<button @click=closeModal>Close</button>
</div>
@DominikAngerer
DominikAngerer / parse-storyblok-comments.php
Last active November 12, 2019 10:39
Manually parse the Storyblok HTML editable comments. Nginx SSI.
<?php
$blok = array("_editable" => "<!--#storyblok#{\"name\": \"column\", \"space\": \"48408\", \"uid\": \"7c44c5d8-0adb-4c01-a797-12d9b300b99b\", \"id\": \"307934\"}-->");
/**
* Manually parse the Storyblok HTML editable comments. Use your templating language to output
* keys = values as html attributes without quotes or with single quotes.
*
* @param array $blok This is your component object
* @param boolean $raw Decide if function should return raw array or inline string
@DominikAngerer
DominikAngerer / demo.json
Last active January 24, 2019 18:05
A demo json for integrations
{
"results_size": 166,
"results": [{
"id": "baf0f820-0fff-456f-9256-0da23bafa481",
"image_url": "https://picsum.photos/150/150?v=afa481",
"last_update": 1509364426938,
"title": "Savannah Mcfadden",
"description": "Eiusmod nisi ut ea et duis consectetur in occaecat non culpa. Sit nisi ut velit non id pariatur in esse enim laboris duis sit. Cillum enim elit nulla labore incididunt. Voluptate eu aute velit culpa est et aute do. Lorem id minim commodo et. Voluptate magna tempor sint cillum aute tempor proident cupidatat sint. Mollit officia non nisi id id nulla exercitation et ullamco ut laboris tempor.",
"blob": {
"field": "field",
@DominikAngerer
DominikAngerer / check-for-unused-components.js
Created January 17, 2019 21:43
Check for unused components in Storyblok
// npm install storyblok-js-client
const StoryblokClient = require('storyblok-js-client')
// This token allows CRUD operations to all your spaces and can be found in the
// "my account" section of our app: https://app.storyblok.com/#!/me/account
// DO NOT COMMIT THAT OAUTHTOKEN!!
const oauthToken = 'your_oauth_token'
// Initialize the client with the oauth token
const Storyblok = new StoryblokClient({
[ { "name":"1" ,"value":"Stefan Fuchs.png" } ,{ "name":"3" ,"value":"Stefan Fuchs.png" } ,{ "name":"4" ,"value":"heaven.jpg" } ,{ "name":"5" ,"value":"heaven.png" } ]
// Option 1
// if you know that you only want 2
let per_page = 100
let responses = await Promise.all([
app.$storyapi.get('cdn/stories/', {
starts_with: 'posts/',
per_page: per_page,
page: 1
}),
app.$storyapi.get('cdn/stories/', {
@DominikAngerer
DominikAngerer / index.vue
Created February 15, 2019 16:18
Nuxt _language/index.vue
<template>
<section class="util__container">
<component v-if="story.content.component" :key="story.content._uid" :blok="story.content" :is="story.content.component"></component>
</section>
</template>
<script>
export default {
data () {
return { story: { content: {} } }