Path alias pattern causes conflict between live and preview
See original GitHub issueHello !
I’m facing a weird problem :
Setting blog/[node:title]
as the path alias pattern does not work: On the app, the URL localhost:3000/blog/slug
resolves to a 404, but localhost:3000/blog/blog/slug
works but obviously isn’t correct.
When I try to access the preview, the resolved URL is localhost:3000/blog/slug
-> does not work (404)
When setting back the path alias pattern back to /[node:title]
correctly resolves on localhost:3000/blog/slug
.
The preview then resolves to localhost:3000/slug
instead of localhost:3000/blog/slug
, resulting in a 404.
Project structure is :
nextjs
|___pages
|____index.js
|____[...slug].js
|____blog
|___index.js
|___[...slug].js
next-drupal
version used is 1.1.1, drupal/next
version is 1.0.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top Results From Across the Web
Pathauto prevents core path functionality [#2881280] - Drupal
Problem/Motivation When an entity whose path is not managed by pathauto's patterns is give a manual URL alias, the alias is not saved....
Read more >Use taxonomy path for a node's path alias - Drupal Answers
All the references to path aliases based on taxonomy that I have found use the entity value of the term, which I don't...
Read more >Learning the Basics - Gradle User Manual
If Gradle finds a module descriptor in a particular repository, it will attempt to download all of the artifacts for that module from...
Read more >Change mappings and settings for a data stream - Elastic
This new data stream will contain data from your existing stream. You can use the resolve index API to check if the name...
Read more >How to Use Kafka Connect - Getting Started
You would export this variable to define the list of paths to the ... a path to plugins can result in library conflicts...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
1. Update
getStaticPaths
inpages/blog/[...slug].js
2. Pass in the
prefix
togetStaticProps
We have a
prefix
option we can use here. Unfortunately next does not provide much incontext
. If we had thedir
info that would be easier.I think we can add the prefix options to
getPathsFromContext
as well to make this a bit simpler.Can you give this a try and let me know?
This is actually pretty clever (even if a little bit clunky) and it works, too !
I totally forgot about the
prefix
option in getResourceFromContext since the context given togetStaticProps
is so poor.The
dir
thingy is something Next community has been asking since forever (like conditional rerendering fired by a Back Office for example haha)You’re truly a life saver, thanks a lot !