jargonsdev / jargonsdev/jargons.dev

Implement Redirect to First Page Route for Alphabetical Browse

Aperta
#61 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

:arrow_upper_right: medium priority :sparkles: enhancement hacktoberfest
Lingua principale
MDX
Stelle
56
Fork
45
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Currently, when a user visits the `/browse/[alpha]` (example "/browse/a") route, they receive a 404 error. This issue requests implementing a redirect to the first page route (`/browse/[alpha]/1` i.e. "/browse/a/1") when a user visits `/browse/[alpha]`. This will ensure a smoother browsing experience for users.

**Steps to Implement:**
1. Detect when a user visits the `/browse/[alpha]` route without specifying a page number.
2. Redirect the user to the first page route (`/browse/[alpha]/1`).

**Implementation Note:**
- The following code snippet could be implemented into a `/browse/[alpha]/index.astro` file to handle the redirection:

```astro
---
/**
* Redirect traffic from `/[alpha]` to `/[alpha]/1` to avoid 404 error
*/
return Astro.redirect(`${Astro.params.alpha}/1`);
---
```

However, there's a build conflict with `/browse/[...slug]`, so it's important to understand the [Route Priority Order](https://docs.astro.build/en/guides/routing/#route-priority-order) for this to work.

**Acceptance Criteria:**
- When a user visits the `/browse/[alpha]` route, they should be automatically redirected to the first page route (`/browse/[alpha]/1`).
- The redirect should happen seamlessly without any additional user input.

**Additional Information:**
- This enhancement will improve user experience by ensuring that users are directed to the correct page when browsing alphabetically.
- It's important to state that I have tried the stated implementation in the implementation note and experienced the conflict myself, It worked by redirecting, but the words route that gets built from `src/content/dictionary` were also getting the redirects; not nice 😞

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia esaminando la route esistente /browse/[...slug] e le route che forniscono contenuti da src/content/dictionary, quindi leggi la guida Astro's Route Priority Order collegata nell'issue. Aggiungi la gestione di /browse/[alpha] in modo che reindirizzi a /browse/[alpha]/1 senza reindirizzare le route delle parole del dizionario, e verifica entrambi i comportamenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
web-dev
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.