kontent-ai / sample-app-react

Sample React SPA utilizing the Kontent.ai Delivery API to fetch content.
https://kontent-sample-app-react.netlify.app/
MIT License
51 stars 73 forks source link

Language specific URL slugs #73

Closed MartinaFarkasova closed 6 years ago

MartinaFarkasova commented 6 years ago

We have a new feature, language-specific URL slugs generated from Text elements. Consider if the React sample app needs to be updated.

See the task in JIRA: https://kentico.atlassian.net/browse/DEL-1635

ivanaliptakova commented 6 years ago

Content types with changed url slug configuration: changed items About us: 1 EN (changed to custom, value not changed), 1 ES (changed to custom, value changed) Accessory: not changed Article: EN not changed, ,ES items changed Brewer: not changed items Coffee: not changed items Grinder: not changed items Home: ES home changed to inicio (custom mode)

Simply007 commented 6 years ago

I have went through the the changed content types About Us, Article, and Home and all are generated from content item name. So i,t, home ES home has still url pattern filed Home, not Inicio. I have use sample project with guid: 975bf280-fd91-488c-994c-2f04416e5ee3

image

But for the multilingual support, we are using language prefixes, that ensures the culture and in out implementation have higher priority - so implement language specific url slugs does not affect functionality. If we want to change the logic of the app, we need to define whole new routing structure.

I have found out the strange behavior - is it expected? I have cloned sample project.

  1. I have changed the content item name on Spanish version to About us esp.
    • URL slug for es version was changed to about-us-esp
  2. I have went to english version
    • Content item name was changed to About us esp
    • Url slug remained about-us
  3. I have changed the content item name on English version to About us en.
    • URL slug for en version was changed to about-us-en So Url slug is now generated from item name, but only in specific language?
petrsvihlik commented 6 years ago

@Simply007 could you please either sync with with @ivanaliptakova to find out what's the preferred behavior or call a meeting for the three of us?

Simply007 commented 6 years ago

I have consulted this with @oravecjakub and correct configuration is already on development environment, so it was my fault - i have checked live project.

Simply007 commented 6 years ago

Final decision - agreed with @oravecjakub: About us:

Articles:

No other changes

Simply007 commented 6 years ago

We dont need to change home, because it is registered under "/" route.

About us is implemented Articles are not performing redirect, because it is no necessary.

We will have /en-us/articles/articleId (/es-es/articles/articleId) route and the request for ID with language specification return correct language data.

https://github.com/Kentico/cloud-sample-app-react/pull/74

Simply007 commented 6 years ago

Added another pull request: https://github.com/Kentico/cloud-sample-app-react/pull/76