-
I followed https://v3.docs.apostrophecms.org/guide/piece-pages.html but I do not end up with auto generated index and show pages at Here are the files I created / changed: // modules/product/index.js
module.exports = {
extend: '@apostrophecms/piece-type',
options: {
label: 'Product',
pluralLabel: 'Products'
},
fields: {
add: {
title: {
type: 'string',
label: 'Title',
required: true
}
},
group: {
basics: {
label: 'Basics',
fields: ['title']
}
}
}
}; // modules/product-page/index.js
module.exports = {
extend: '@apostrophecms/piece-page-type',
options: {
label: 'Product Page',
pluralLabel: 'Product Pages',
pieceModuleName: 'product'
},
}; <!-- modules/product-page/views/index.html -->
{% extends "layout.html" %}
{% block main %}
<h1>Product List</h1>
{% for piece in data.pieces %}
<article>
<h2>
<a href="{{ piece._url }}">{{ piece.title }}</a>
</h2>
</article>
{% endfor %}
{% endblock %} <!-- modules/product-page/views/show.html -->
{% extends "layout.html" %}
{% block main %}
<h1>{{ data.piece.title }}</h1>
{% endblock %} // app.js
require('apostrophe')({
shortName: 'myproject',
modules: {
'@apostrophecms/rich-text-widget': {
options: {
className: 'bp-rich-text'
}
},
'@apostrophecms/image-widget': {
options: {
className: 'bp-image-widget'
}
},
'@apostrophecms/video-widget': {
options: {
className: 'bp-video-widget'
}
},
'product': {},
'product-page': {},
asset: {},
'default-page': {}
}
}); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hmm. I don't see here where you added The documentation page you mention references our page type guide. The section you missed is here: https://v3.docs.apostrophecms.org/guide/pages.html#activating-page-types Perhaps we'll add a link to that specific section as a refresher for those in your situation. |
Beta Was this translation helpful? Give feedback.
-
Yes, this solves it! I enjoyed reading the documentation so far but I must have missed that this last step works the same as for Thank you guys for this wonderful project! |
Beta Was this translation helpful? Give feedback.
Hmm. I don't see here where you added
product-page
to the list of available page types, or an indication that you then logged into your site and added a page at/products
for which you chose the type "Product Page."The documentation page you mention references our page type guide. The section you missed is here:
https://v3.docs.apostrophecms.org/guide/pages.html#activating-page-types
Perhaps we'll add a link to that specific section as a refresher for those in your situation.