@@ -12,6 +12,8 @@ const models = {
1212const defaultSettings = {
1313 categoryAlias : undefined ,
1414 entryAlias : undefined ,
15+ categoriesAlias : undefined ,
16+ entriesAlias : undefined ,
1517 mode : 'start' ,
1618 level : 1 ,
1719 contentTypes : [ ] ,
@@ -47,12 +49,16 @@ class Category extends ContentModelEntryNode {
4749 attachments : category . subtree . attachments . map ( models . Attachment . serialize )
4850 }
4951
50- if ( category . entriesAlias ) {
51- data [ category . entriesAlias ] = data . posts
52+ // Alias for the posts key in category
53+ const entriesAlias = category . entriesAlias || category . settings . entriesAlias
54+ if ( entriesAlias ) {
55+ data [ entriesAlias ] = data . posts
5256 }
5357
54- if ( category . categoriesAlias ) {
55- data [ category . categoriesAlias ] = data . categories
58+ // Alias for the categories key in category
59+ const categoriesAlias = category . categoriesAlias || category . settings . categoriesAlias
60+ if ( categoriesAlias ) {
61+ data [ categoriesAlias ] = data . categories
5662 }
5763
5864 return data
@@ -142,17 +148,6 @@ class Category extends ContentModelEntryNode {
142148 attachments : [ ]
143149 }
144150
145- const entriesAlias = this . entriesAlias || this . settings . entriesAlias
146- const categoriesAlias = this . categoriesAlias || this . settings . categoriesAlias
147-
148- if ( entriesAlias ) {
149- tree [ entriesAlias ] = tree . posts
150- }
151-
152- if ( categoriesAlias ) {
153- tree [ categoriesAlias ] = tree . categories
154- }
155-
156151 if ( ! this . fsNode . children || ! this . fsNode . children . length ) {
157152 return tree
158153 }
@@ -193,6 +188,7 @@ class Category extends ContentModelEntryNode {
193188 const subCategorySettings = {
194189 contentTypes : this . settings . contentTypes ,
195190 entryContentType : this . entryContentType || this . settings . entryContentType ,
191+ categoryContentType : this . categoryContentType || this . settings . categoryContentType ,
196192 entryAlias : this . entryAlias || this . settings . entryAlias ,
197193 categoryAlias : this . categoryAlias || this . settings . categoryAlias ,
198194 entriesAlias : this . entriesAlias || this . settings . entriesAlias ,
@@ -272,17 +268,23 @@ class Category extends ContentModelEntryNode {
272268 settings,
273269 debug
274270 }
275- const { categoryAlias, entriesAlias } = this . settings
276- if ( categoryAlias ) {
277- data [ categoryAlias ] = data . category
271+
272+ // Alias for the current category
273+ if ( this . settings . categoryAlias ) {
274+ data [ this . settings . categoryAlias ] = data . category
278275 }
276+
277+ // Alias for the paginated 'posts'
278+ const entriesAlias = this . entriesAlias || this . settings . entriesAlias
279279 if ( entriesAlias ) {
280280 data [ entriesAlias ] = data . posts
281281 }
282+
283+ const contentType = this . contentType || this . settings . categoryContentType
282284 return renderer . render ( {
283285 templates : [
284286 `pages/${ this . template } ` ,
285- `pages/category/${ this . contentType } ` ,
287+ `pages/category/${ contentType } ` ,
286288 `pages/category/default`
287289 ] ,
288290 outputPath,
0 commit comments