I have a widget where I can handpick links to other pages on the site.
In focuslinks-widgets/views/widget.html:
{% for piece in data.widget._pieces %}
<div class="col-md-4 col-sm-4">
<a href="{{ piece._page._url }}" class="button">{{ piece.title }}</a>
</div>
{% endfor %}
My focuslinks/index.js
module.exports = {
extend: 'apostrophe-pieces',
name: 'focuslink',
label: 'Fokuslink',
pluralLabel: 'Fokuslinker',
addFields: [
{
name: 'title',
label: 'Navn',
type: 'string',
required: true
},
{
name: '_page',
type: 'joinByOne',
withType: 'apostrophe-page',
label: 'Side',
required: true,
idField: 'pageId'
}
]
};
This was working as intended, but I had another problem resulting in slow page multiple warnings about missing projections. So for the above widget, I added projections in app.js:
'supernode-focuslinks': {},
'supernode-focuslinks-widgets': {
extend: 'apostrophe-pieces-widgets',
filters: {
projection: {
slug: 1,
title: 1,
type: 1,
tags: 1
}
}
},
Now after this the widget is displaying as before, but there are no href url generated by {{ piece._page._url }} anymore. What am I doing wrong?