Routing to transformed match - Static Site Generation #22012
Replies: 3 comments 1 reply
-
Also see #22333 |
Beta Was this translation helpful? Give feedback.
-
@Timer @timneutkens @ijjk - We need to enhance Note: If my reading of the code is correct, the Sample Use Cases:
Please include it in the roadmap and prioritize it. |
Beta Was this translation helpful? Give feedback.
-
Another use case is when users request data about something - and if exact match is not available, you provide nearest match / more likely answer. In case of a ecommerce site, if a user asks for a specific perfume and if the specific perfume is not available, one can display the list of all perfumes. |
Beta Was this translation helpful? Give feedback.
-
Describe the feature you'd like to request
Suppose I have
pages/ads/[lat]/[lon].js
I want all the following requests
pages/ads/12.3456/98.7654
pages/ads/12.3567/98.7543
pages/ads/12.3345/98.7876
to match a statically generated page (using
getStaticProps
)pages/ads/12.3/98.7
Note: For simplicity - I have just truncated the digits
We can extend the use case to more sophisticated URL transformations.
How is this possible without modifying the client?
Describe the solution you'd like
The match logic for statically generated pages has to factor a predefined transformation of the URL.
The pre defined transformation could be a function that takes the arguments in square brackets and provides the new values
Describe alternatives you've considered
The option I can think of is getServerSideProps, but that does not provide the benefits of Static Site Generation
Will be really useful in a number of usecases
Beta Was this translation helpful? Give feedback.
All reactions