locomotivecms / steam

The rendering stack used by both Wagon and Station (new name of the engine). It includes the rack stack and the liquid drops/filters/tags.
MIT License
38 stars 59 forks source link

Localized page with a non localized content entries #157

Open proxygear opened 5 years ago

proxygear commented 5 years ago

Context

I have a the following content type :

slug: departments
name: Departments
order_by: code
order_direction: asc
label_field_name: code
fields:
- code:
    label: Code
    type: string
    localized: false
    required: true
- name:
    label: Département
    type: string
    required: true

As you can see, none of the fields are localized.

Code

https://github.com/locomotivecms/steam/blob/master/lib/locomotive/steam/middlewares/templatized_page.rb

      def fetch_content_entry(slug)
        if type = content_type_repository.find(page.content_type_id)
          # don't accept a non localized entry in a locale other than the default one
          return nil if type.localized_names.count == 0 && locale.to_s != default_locale.to_s

          decorate_entry(content_entry_repository.with(type).by_slug(slug))
        else
          nil
        end
      end

I don't get why we shouldn't have a localized page for a non localized content. To get around that, I just added a non editable, non required localized field. It's just strange.

did commented 4 years ago

hi @proxygear, I met the exact same problem 2 days ago on a Locomotive site. I think the problem is related to SEO. Basically, Google doesn't really like when a site has 2 different pages with the exact same content. Right now, I don't know what the right behavior should be. What's your opinion?

proxygear commented 4 years ago

As you can see in my example, it's a list of French department. So I want to have :

The code and the name of the departement stay the same (It would be the same with city names). The reste of the page content gonna be translated to the targeted language. I guess Google will not have a problem with it. .