Jump to content

Building custom page URLs from field content?


ttbb
 Share

Recommended Posts

hi there,
i'm pretty new to processwire after switching to a more slim, less dependency affected and more customizable CMF after 15 years with drupal ?
after some weeks with tests and with staring up a new project i didn't regret my switch ?

currently i'm working on an art gallery website, in its core consisting of two pages types with their respective templates: artists and artworks.
artworks are mandatory connected to an artists.
the URLs are /artists/someArtistsName and /artworks/someArtworksTitle.
for better readable (SEO) and semantic usable URLs i want to have the artworks URLs automatically rewritten to /artworks/someArtistsName/someArtworksTitle after an artwork page has been created.
inside of the artworks template the artist lives in a field with page reference type.
i did intensive research here in the forum and on the web but didn't find a solution. maybe there's module for this? or how can i do this by adding this to the artworks template (hooks?).

my be the collective community knowledge can point me in the right direction?
any help is appreciated very much!

best from vienna / austria
thomas

Link to comment
Share on other sites

Hi @ttbb welcome to PW and the community ? 

one solution would be to enable url segments on the template of /artworks page. https://processwire.com/docs/front-end/how-to-use-url-segments/

That means you'd have an url like /artworks/[artist]/[artwork] and you'd have the artist in $input->urlSegment1 and the artwork in $input->urlSegment2

Does that help?

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...