02-clothes
has a permalink of clothes
so all posts in the folder become clothes/post-title
02-clothes
then it should create 02-clothes/post-title
beta
you could create a custom transform plugin that given a configuration, inspect each post data._entry and modify the category based in the path, but that might be much simpler by just removing the category in the post front matter if you don't need to set a category different than the folder name.
thanks for all the time your putting into it! you're
ingloriouscoderz.github.io git:(v2) ✗ npm run dev
> ingloriouscoderz.github.io@2.0.0 dev /Users/elmasse/tmp/ingloriouscoderz.github.io
> nextein
Defining routes from exportPathMap
> Using "webpackDevMiddleware" config function defined in default.
✔ success server compiled in 522ms
Compiling
✔ success client compiled in 2s 395ms
DONE Compiled successfully in 3042ms 12:57:52 AM
watching changes in folders: [ 'posts' ]
> Ready on http://localhost:3000
^C⏎
➜ ingloriouscoderz.github.io git:(v2) ✗ npm run export
> ingloriouscoderz.github.io@2.0.0 export /Users/elmasse/tmp/ingloriouscoderz.github.io
> nextein build && nextein export
[12:57:58 AM] Compiling client
[12:57:59 AM] Compiling server
> Using external babel configuration
> Location: "/Users/elmasse/tmp/ingloriouscoderz.github.io/.babelrc"
Total precache size is about 0 B for 0 resources.
[12:59:15 AM] Compiled server in 1m
Total precache size is about 0 B for 0 resources.
[12:59:39 AM] Compiled client in 2m
> using build directory: /Users/elmasse/tmp/ingloriouscoderz.github.io/.next
copying "static" directory
copying "static build" directory
Creating entries...
> posts--blog--2016-02-21-hello-world--Qm20YjNljHRpqrRe~dgxF.json
> posts--blog--2016-05-11-il-vaso-di-piva--Qm20YjNljHRpqrRe~dgxF.json
> posts--blog--2016-07-21-resistere-alla-tentazione-del-procedurale-in-redux--Qm20YjNljHRpqrRe~dgxF.json
> posts--blog--2016-07-22-pokemon-go-e-la-teoria-degli-effetti-collaterali--Qm20YjNljHRpqrRe~dgxF.json
> posts--blog--2016-11-16-componenti-react-redux-come-librerie--Qm20YjNljHRpqrRe~dgxF.json
> posts--blog--2018-02-08-migliorare-il-codice-con-il-currying--Qm20YjNljHRpqrRe~dgxF.json
> posts--blog--2018-10-23-loopback-porting-di-spring-boot--Qm20YjNljHRpqrRe~dgxF.json
> exporting path: /blog/hello-world
i18next: languageChanged it
i18next: initialized { debug: true,
initImmediate: true,
ns: [ 'translation' ],
defaultNS: [ 'translation' ],
fallbackLng: [ 'en' ],
fallbackNS: false,
whitelist: false,
nonExplicitWhitelist: false,
load: 'all',
preload: false,
simplifyPluralSuffix: true,
keySeparator: false,
nsSeparator: false,
pluralSeparator: '_',
contextSeparator: '_',
saveMissing: false,
updateMissing: false,
saveMissingTo: 'fallback',
saveMissingPlurals: true,
missingKeyHandler: false,
missingInterpolationHandler: false,
postProcess: false,
returnNull: true,
returnEmptyString: true,
returnObjects: false,
joinArrays: false,
returnedObjectHandler: [Function: returnedObjectHandler],
parseMissingKeyHandler: false,
appendNamespaceToMissingKey: false,
appendNamespaceToCIMode: false,
overloadTranslationOptionHandler: [Function: handle],
interpolation: { escapeValue: false },
resources:
{ en: { translation: [Object] }, it: { translation: [Object] } },
lng: 'it' }
> exporting path: /blog/il-vaso-di-piva
> exporting path: /blog/resistere-alla-tentazione-del-procedurale-in-redux
> exporting path: /blog/pokemon-go-e-la-teoria-degli-effetti-collaterali
> exporting path: /blog/componenti-react-redux-come-librerie
> exporting path: /blog/migliorare-il-codice-con-il-currying
> exporting path: /blog/loopback-porting-di-spring-boot
> exporting path: /
> exporting path: /how
> exporting path: /what
> exporting path: /when
> exporting path: /where
> exporting path: /who
> exporting path: /why
> exporting path: /blog
Export successful
No can do. I tried a few things:
.next
and out
before re-exportingnext-ga
(although in my workspace next-ga
works, and keeping it or removing it yields the same effect)nextein/link
from blog to post (I saw a difference here: next/link
reloads the page, while nextein/link
navigates client-side)In every test I could yarn dev
successfully but couldn't export due to
TypeError: Cannot read property 'data' of undefined
at /home/antony/ingloriouscoderz.github.io/.next/server/static/1Ot7g708GPGusjwGsThCe/pages/post.js:814:11
> exporting path: /blog/il-vaso-di-piva
> exporting path: /blog/resistere-alla-tentazione-del-procedurale-in-redux
> exporting path: /blog/pokemon-go-e-la-teoria-degli-effetti-collaterali
> exporting path: /blog/componenti-react-redux-come-librerie
> exporting path: /blog/migliorare-il-codice-con-il-currying
> exporting path: /blog/loopback-porting-di-spring-boot
> exporting path: /
> exporting path: /blog
> exporting path: /how
> exporting path: /index
> exporting path: /post
exportPathMap
to exclude that path
exportPathMap: defaultPathMap => ({
// ...defaultPathMap, no thanks
'/how': { page: '/how' },
'/what': { page: '/what' },
'/when': { page: '/when' },
'/where': { page: '/where' },
'/who': { page: '/who' },
'/why': { page: '/why' },
'/blog': { page: '/blog' },
}),
Hey @elmasse ! Thanks for the recent bugfixes! As we discussed in elmasse/nextein-starter#7 I'm trying to build a hybrid application (SSR nextjs/static markup Blog with netlify cms connection).
Only thing I'm still struggling a bit is the static exporting with nextein export
. Here is what I've tried so far:
exportPathMap
like below, exporting works, but i get 404 for the detail view of my posts
. Links from my blog index to my posts page work though. exportPathMap: (defaultPathMap) => ({
'/blog': { page: '/blog' }
})
exportPathMap
at all, exporting of my posts
work, but I can't deploy to AWS because of compiling errors, because it tries to export all of my pages (also my dynamic/SSR pages, which I don't want to export)posts
specifically I get the TypeError: Cannot read property 'data' of undefined
error mentioned above. But I don't know how to specify exportPathMap for dynamic posts
exportPathMap: (defaultPathMap) => ({
'/blog/:slug': { page: '/post'} //TypeError: Cannot read property 'data' of undefined error
'/blog/:slug': { page: '/post', query: { title: ':slug' } } //infinite loop
'/blog/first-post': { page: '/post', query: { title: 'first-post' } } //TypeError: Cannot read property 'data' of undefined error
})
So I'm trying to find a way to export my /blog
page and my posts, which should be reachable under /blog/name-of-my-post
and none of my other SSR pages. Do you have any idea how I can do that?dev
is not the same object as in prod
nextein start
as in prod. It will let some watcher opened so maybe I need to get a new version for this.
exportPathMap: (defaultPathMap) => {
let defaultPathArray = Object.values(defaultPathMap)
defaultPathArray.filter(obj => {
if(!Object.keys(obj).includes("query"))
delete defaultPathMap[ obj.page ]
})
return {
...defaultPathMap
}
}