Ghost Blog custom routes returning error "err_too_many_redirects"

Asked

Viewed 13 times

1

I’m working on a study site using Ghost. The idea is to classify the study contents in reading plans, using as filter specific tags.

In this way I group several articles within the same plan and the idea is to make available through the following url structure: /planos/nome-do-plano/{slug}.

In /planos/nome-do-plano/ all content related to the reading plan in question will be rendered, while /planos/ will be rendered all reading plans available on the site.

For that I set up mine Routes.yaml as follows:

routes:
  /planos/: plans
  /planos/os-tesouros-salmo-119/: plans-psalm-119
  /planos/evangelho-de-joao/: plans-john
  /planos/malaquias-hoje/: plans-malachi

collections:
  /planos/malaquias-hoje/:
    permalink: /planos/malaquias-hoje/{slug}/
    filter: 'tag:malaquias-hoje'
    template: plans-malachi
    rss: false

  /planos/os-tesouros-salmo-119/:
    permalink: /planos/os-tesouros-salmo-119/{slug}/
    filter: 'tag:os-tesouros-do-salmo-119'
    template: plans-psalm-119
    rss: false

  /planos/evangelho-de-joao/:
    permalink: /planos/evangelho-de-joao/{slug}/
    filter: 'tag:evangelho-de-joao'
    template: plans-john
    rss: false

  /:
    permalink: /{slug}/
    template: index

taxonomies:
  tag: /{slug}/
  author: /autor/{slug}/

How I defined in Routes.yaml that the permalink of tags will be only /{slug}/ in the Redirects.json i direct the tags corresponding to the reading plan to your own page (/plano/nome-do-plano).

[
  {
    "from": "/os-tesouros-do-salmo-119/" ,
    "to":  "/planos/os-tesouros-salmo-119/",
    "permanent": true
  },
  {
    "from": "/evangelho-de-joao/" ,
    "to":  "/planos/evangelho-de-joao/",
    "permanent": true
  },
  {
    "from": "/malaquias-hoje/" ,
    "to":  "/planos/malaquias-hoje/",
    "permanent": true
  }
]

But the only plan that works properly is the /os-tesouros-salmo-119/ (who was the first to be created) all the others when I try to access the main page of the plan (/plano/nome-do-plano/) returns the error "ERR_TOO_MANY_REDIRECTS".

It is worth noting that only the main page of the reading plan is affected, the articles published within the reading plans (/plano/nome-do-plano/artigo-01/) which are not accessible can read normally.

And the generated url is always something like this: http://localhost:2368/planos/planos/planos/planos/planos/planos/planos/planos/planos/planos/planos/planos/planos/planos/planos/planos/planos/planos/planos/planos/evangelho-de-joao/.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.