Skip to content

Instantly share code, notes, and snippets.

@PayteR
Created October 12, 2021 00:44
Show Gist options
  • Save PayteR/3f2a6d7257d8237c53b1dd88c21b3d6f to your computer and use it in GitHub Desktop.
Save PayteR/3f2a6d7257d8237c53b1dd88c21b3d6f to your computer and use it in GitHub Desktop.
{
/**
* PostType paths
*/
// list of articles for category with pagination
{
path: '/posttype/category/:path+/page/:page(\\d+)/',
component: () => interopDefault(import('~/pages/archive/Category.vue')),
name: 'term-category_article-paged',
meta: { taxonomy: 'category' },
pathToRegexpOptions: { strict: true }
},
// same as list of articles for category but only first page
{
path: '/posttype/category/:path+/',
component: () => interopDefault(import('~/pages/archive/Category.vue')),
name: 'term-category_article',
meta: { taxonomy: 'category' },
pathToRegexpOptions: { strict: true }
},
// list of all articles for post type with pagination
{
path: '/posttype/page/:page(\\d+)/',
component: () => interopDefault(import('~/pages/archive/Archive.vue')),
name: 'archive-article',
meta: {},
pathToRegexpOptions: { strict: true }
},
// same as list of all articles for post type but only first page
{
path: '/posttype/',
component: () => interopDefault(import('~/pages/frontpage/Archive.vue')),
name: 'frontpage-article',
pathToRegexpOptions: { strict: true }
},
// detail of article
{
path: '/posttype/:slug/',
component: () => interopDefault(import('~/pages/single/Article.vue')),
name: 'single-article',
props: route => ({
slug: route.params.slug
}),
pathToRegexpOptions: { strict: true }
}
}
@PayteR
Copy link
Author

PayteR commented Oct 12, 2021

Hi, could someone tell me, how to make only 3 rules for this? Routes list of articles and list of all articles are 2x here, because of pagination, is there a way how to make it by 1 rule?

And is there any chance to make it all by just one rule?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment