Content: How to avoid generating routes for nonexistent articles?

Created on 26 Aug 2020  路  3Comments  路  Source: nuxt/content

I have the following structure:

content/
    articles/
        en/
            my-first-article.md
        pt/
            meu-primeiro-artigo.md
            meu-segundo-artigo.md // not every file has its correspondence in the other language

The problem is that the crawler (I think) is trying to generate routes such as en/meu-primeiro-artigo and pt/my-first-article. I have several _Error generating route_ when running _yarn generate_.

The blog is working fine. Does anybody know how could I avoid those errors? How to avoid the crawler to generate routes for nonexistent articles? Thanks!

question

All 3 comments

Hi, would you mind providing a reproduction link on CodeSandbox? Or perhaps you can share it in a public repo (with sensitive data redacted/removed if you wish)?

From what I know, the crawler will only generate the routes if it sees nuxt-links that are targeting/pointing to the non-existent articles, so we might need to find out why the nuxt-links are created in the first place.

Hi, do you use the i18n module as well ? Maybe your lang switcher isn't able to determine the right slug of the article in other languages and ends up putting the same slug.

Hey guys! Thanks a lot for answering my question. You both helped me to figure out what was going on. I only have 'pt-BR' posts for now, but in each post page I had a language switcher that was pointing to a non-existent route. My bad.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Haeresis picture Haeresis  路  3Comments

haykokalipsis picture haykokalipsis  路  4Comments

emp1tsu picture emp1tsu  路  3Comments

dolbex picture dolbex  路  3Comments

ctwhome picture ctwhome  路  4Comments