code: func flattenPublish(config jsonconfig.Obj) error {
  	gallery := []string{}
  	blog := []string{}
  	config["gallery"] = gallery
  	config["blog"] = blog
  	published, ok := config["publish"]
  	if !ok {
  		delete(config, "publish")
  		return nil
  	}
  	pubObj, ok := published.(map[string]interface{})
  	if !ok {
  		return fmt.Errorf("Was expecting a map[string]interface{} for \"publish\", got %T", published)
  	}
  	for k, v := range pubObj {
  		pub, ok := v.(map[string]interface{})
  		if !ok {
  			return fmt.Errorf("Was expecting a map[string]interface{} for %s, got %T", k, pub)
  		}
  		template, rootPermanode, style := "", "", ""
  		for pk, pv := range pub {
  			val, ok := pv.(string)
  			if !ok {
  				return fmt.Errorf("Was expecting a string for %s, got %T", pk, pv)
  			}
  			switch pk {
  			case "template":
  				template = val
  			case "rootPermanode":
  				rootPermanode = val
  			case "style":
  				style = val
  			default:
  				return fmt.Errorf("Unknown key %q in %s", pk, k)
  			}
  		}
  		if template == "" || rootPermanode == "" {
  			return fmt.Errorf("missing \"template\" key or \"rootPermanode\" key in %s", k)
  		}
  		obj := []string{k, rootPermanode, style}
  		config[template] = obj
  	}
  
  	delete(config, "publish")
  	return nil
  }
docs: // TODO(mpl): probably not needed anymore. check later and remove.
  // Flatten all published entities as lists and move them at the root
  // of the conf, to have them displayed individually by the template