'Contentful and get all city pages links that are in a particular state
I'm having a devil of a time modeling things in Contentful. I did the tutorials, but still don't even know where to begin.
I sell tutoring services, brokering, in many states. So, I want to display, on front page, all the states... but when click, you get all the cities... you click a city, you get all the tutoring topics.
This, as you can imagine, will get into the thousands as I am very SEO conscious and will need custom info per city etc..
How would/should I model the US, then then states, then cities...and each city could have like 4 or 5 separate tutoring pages. 1 specific for Math, or Spanish or Guitar etc..
I guess US & state will have one to many relationships, but how do I create "links", so I can:
- List out all states
- List out all cities
- Get particular city page with tutorials. User would have selected something like /us/california/san-diego/lesson-guitar.
So, user lands on homepage
Alabama
Arkansas
California
Connecticut
etc...
`1. Person clicks on California..
2. Person sees some California info, like a page:California
3. At bottom of page, a list of all the serviceable cities.
4. Person clicks city. Let's say San Diego. They see the page:sanDiego page.. with list of tutoring etc..`
There seems there will be page types, but not sure how to add links to the various cities, states etc...
Like, what field would I add to show all valid states in the US? Would that be a separate content type? Or would I add that to the various "pages" and would it be an array or ?
So confusing.
Solution 1:[1]
In this case, I'll create a separate content type for States and Cities. In the tutoring and brokering content types, I will then add a reference field that would refer to the City and State content type.
Hope this helps :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | harshil1712 |