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
Add pretty URL slugs to listing pages #233
Conversation
2ca3fe7
to
f7ead05
Compare
@bencpeters Nice solution! I'm wondering if we even need the guid in the the URL though? The number of available listings isn't that high so certainly no real risk of slug collision. |
Personally, I like having the guid in there - it allows us to keep a "stable" URL in cases where the listing I don't feel super strongly on it though. |
That's a good point. Probably wouldn't happen after a listing goes live, but during development I could see that. Maybe we can knock the id length down to 8 characters or something of that nature? |
Ya, that seems reasonable. Where are those IDs generated right now? I just saw them listed in the JSON data files? |
Now that you mention it, they are totally arbitrary (hard-coded into the JSON). So perhaps we can file that as a separate issue related to the future Listings service. |
FWIW, I'd definitely be in favor of shorter nanoids. Perhaps 8 characters, which should give us a 1% chance of collision every ~239 years if we generate 1/hr? I'm open to other lengths, though. |
* Fix unit summary availability (core #224) * Fixes for building criteria and preferences on listing (core #223) * Insert GTM tags into page (core #195) * Make floor optional for listings (core #225) * Style changes (core #228) * Added .idea (WebStorm config) to gitignore (core #234) * Add .vscode to .gitignore (core #235) * Add pretty URL slugs to listing pages (core #233) * Add local development and dev site GTM keys (core #240) * tech demo version "0.1" of Submit an Application form (core #232) * Add lerna (core #226) * fix production env key in netlify.toml (core #252) * Upgrade prettier (core #214) * Minor dependency updates to build and test tools (core #264) * catch apps up with prettier 2 * match next.config with reference * add redirect module now that it's enabled Co-authored-by: Marcin Jędras <mjjedras@gmail.com> Co-authored-by: Jared White <jared@jaredwhite.com> Co-authored-by: Ben Kutler <ben@benkutler.com> Co-authored-by: Jesse James Arnold <jesse.james@exygy.com> Co-authored-by: Jesse Arnold <jessearnold@Jesses-MacBook-Pro.local> Co-authored-by: Ben Peters <bencpeters@gmail.com>
Add pretty URL slugs to listing pages
This PR adds descriptive url "slugs" to the end of listing page URLs:
/listing/jsQvgvy6eJy56TNCFfQp8
=>/listing/jsQvgvy6eJy56TNCFfQp8/the_triton_55_triton_park_lane_foster_city_ca
The bare "id-only" URLs will still work; they issue an immediate 301 redirect to the pretty version. This PR adds a general purpose
Redirect
component to accomplish this.The url slug is available as an attribute
urlSlug
on theListing
type.Minor version bump of
eslint-typescript
to allow function definitions. This was necessary to avoid an eslint error on this line.Closes #215