Oussama Mhamadi
Oussama Mhamadi

Reputation: 71

Apostrophecms: parseAggregate: expected colon after dict key

I am new in apostrophecms i am building my first app, i want to define widgets in home using macro but When the JS calls nunjucks render, I get the following error:: parseAggregate: expected colon after dict key

this is my Home page:

{#apostrophe-pages/views/home.html#}
{% extends "layout.html" %}

{% import "macros/utils.html" as areas %}

{% block title %}Home{% endblock %}

{% block main %}

<main>
  {{ areas.columns() }}
</main>

{% endblock %}


{#views/macros/utils.html#}

{% macro columns() %}
{{ apos.area(data.page, 'main', {
    blockLevelControls; true,
    widgets: {
      'one-column': {},
      'two-column': {}
      }
    }
  }) }}
{% endmacro %}

{% macro column(parent, name, imageSize) %}
{{ apos.area(parent, name, {
    widgets: {
      'apostrophe-rich-text': {
        toolbar: [ 'Styles', 'Bold', 'Italic', 'Link', 'Unlink' ],
        styles: [
        { name: 'Heading', element: 'h3' },
        { name: 'Subheading', element: 'h4' },
        { name: 'Paragraph', element: 'p' }
        ]
      },
      'apostrophe-images': {
        size: 'imageSize'
      },
      'apostrophe-video': {},
      'test': {}
    }
  }) }}
{% endmacro %}

Upvotes: 0

Views: 1643

Answers (1)

jkoestinger
jkoestinger

Reputation: 1010

You have a typo in your literal object declaration. Instead of

{{ apos.area(data.page, 'main', {
    blockLevelControls; true,
    widgets: {
      'one-column': {},
      'two-column': {}
      }
    }
  }) }}

it should be

{{ apos.area(data.page, 'main', {
    blockLevelControls: true, // <- Here is a colon now
    widgets: {
      'one-column': {},
      'two-column': {}
      }
    }
  }) }}

Upvotes: 2

Related Questions