Skip to content

Instantly share code, notes, and snippets.

sub vcl_hash {
#FASTLY hash
log {"syslog url"} req.url " host " req.http.host " authorization " req.http.Authorization " request " req.request " postbody " req.postbody " hash " req.hash
return(hash);
}

How to preview your translations in DatoCMS interface

  1. Open a DatoCMS administrative area of your own (ie. https://my-site.admin.datocms.com)

  2. Open the Browser Inspector and in the console write down the following:

    localStorage.setItem('customMessagesUrl', 'https://raw.githubusercontent.com/datocms/translations/master/it.json')
    

    You obviously need to change the URL to your own JSON file.

  3. Refresh the page

**Jeff Escalante**
# Dato & Contentful
There are many areas in which I'd consider Dato to be much stronger of a CMS than
contentful, and one in which I'd consider the opposite to be the case. I will try to be as
balanced as possible with this overview, as I am not employed by dato or anything ‐ my
goal is to ensure that my clients and developers get the best possible experience working
with a CMS.
@stefanoverna
stefanoverna / dato.config.js
Last active March 13, 2023 05:22
Simple backup of DatoCMS content
// First option:
// This will dump every content of a DatoCMS space in the "backup" directory
// To be used with the `dato dump` command (see https://docs.datocms.com/other/basic-usage.html)
module.exports = (dato, root, i18n) => {
i18n.availableLocales.forEach(locale => {
root.directory(`backup/${locale}`, localeDir => {
dato.itemTypes.forEach(itemType => {
localeDir.createDataFile(
`${itemType.apiKey}.json`,
[
"https://1a3a62c54d955c8749cc9-admin.hardypress.com/sitemap.xml"
]
source "https://rubygems.org"
gem "unsplash"
const htmlTag = require('html-tag');
const stringifyObject = require('stringify-object');
const toHtml = (tags) => (tags.map(({tagName, attributes, content}) => (htmlTag(tagName, attributes, content))).join(""));
module.exports = (dato, root, i18n) => {
i18n.availableLocales.forEach((locale) => {
i18n.withLocale(locale, () => {
root.createPost(`content/_index.${locale}.md`, 'yaml', {
frontmatter: {
title: dato.index.title,
source "https://rubygems.org"
ruby "2.3.1"
gem "rails", "5.0.0.1"
gem "rails-i18n"
gem "pg"
gem "active_model_serializers", "~> 0.10.0"
gem "activerecord-session_store"
gem "acts-as-taggable-on",
source "https://rubygems.org"
ruby "2.3.1"
gem "active_model_serializers", "0.10.0.rc4"
gem "addressable"
gem "aws-sdk"
gem "bcrypt"
gem "email_validator"
gem "faraday"
new SpikeDatoCMS({
addDataTo: locals,
token: 'xxx',
templates: [
{
collection: (dato) => dato.blogPosts,
path: 'templates/post.html',
output: (post) => { return `posts/${post.slug}.html` }
}
]