Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build directory output for catch-all routes #10190

Closed
Timer opened this issue Jan 21, 2020 · 3 comments
Closed

Build directory output for catch-all routes #10190

Timer opened this issue Jan 21, 2020 · 3 comments
Milestone

Comments

@Timer
Copy link
Member

Timer commented Jan 21, 2020

Thanks for the quick response to this. Unfortunately I don't think this is fully resolved:

On 9.2.1-canary.5,

With exportTrailingSlash: true in next.config.js,

With template pages/[...slug].jsx,

export async function unstable_getStaticPaths() {
	return [{ params: { slug: ['en_CA', 'about'] } }];
}

export async function unstable_getStaticProps({ params }) {
	console.log('\nparams', params);
	const { slug } = params;
	const props = {
		props: {
			slug,
		},
	};

	return props;
}

The build works, but the nested directories created are not as (I) expected:

Note the directory named en_CA%2Fabout:
image

This is the build console output. Note the slug is passed to getStaticProps as a single string within an array (params { slug: [ 'en_CA/about' ] }):

image

What I think is expected behavior - let me know if I'm off here:

  • The directory structure should be created to match the the catch-all path
  • The slug value is passed either as an array of strings (as returned from getStaticPaths) OR as a single string (concatenated with /), but not a single string within an array.

Originally posted by @dpfavand in #10173 (comment)

@jamesvidler
Copy link

I can confirm this works when exportTrailingSlash is set to false.

@Timer
Copy link
Member Author

Timer commented Feb 3, 2020

Fixed via #10379

@Timer Timer closed this as completed Feb 3, 2020
@Timer Timer modified the milestones: ssg, 9.3.0 Mar 9, 2020
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants