Contentful logo

Contentful Community

Content modelling for localized AND locale-specific blog posts

Hi there,

I am currently building a blog in multiple locales that has the following requirements:

  • Locale code prefixing path (e.g. http://example.com/en and http://example.com/da)
  • Localized slugs (e.g. /en/posts/hello-world and /da/posts/hej-verden)
  • Ability to translate post in multiple locales (e.g. same post translated in English and Danish)
  • Ability to create posts for only one locale (e.g. one post only in Danish and to be published only in da)

I’m wondering what the best way to model this is, as there doesn’t seem to be a natural way to do this without some compromises for each option.

One of the problems I am facing with any option I’ve come up with so far is that I can’t really have any required fields, as I won’t necessarily always have all translations for a given blog post (in fact, this will probably very rarely be the case)‎. Because of that, posts can then be published without content that should be required (e.g. title, slug).

Aside from that, one way I have thought to meet the requirements above is to have a field in the blog post entry called something like “Show in this locale?”, which would be translatable, so that for each locale, there would be a boolean option to decide if this post should be shown in that locale (see picture below).

I have also tried entry-level localization as is suggested here: https://www.contentful.com/developers/docs/concepts/locales/#entry-level-localization, but this seems awfully complicated for content editors, as for each post they have to create a “global” post as well as we “local” post. Also, this feels very hacky, as for the “local” post you are writing in, for example, Danish into fields which say they are for English. It’s also not great for developers (such as myself), given that it’s a lot less straightforward to query and filter data/posts.

I don’t think this is an especially unique use case and I’m sure people have done similar things before, but after a couple of days of Googling and trying out different options, I still haven’t found an ideal scenario.

Hope to hear some great suggestions!

Hi,
We had the same issue but with more than 20 locales.
We used the entry-pattern localization + fallback to a english locale in case you don’t want to localize to a certain locale.