CMS Dynamic URLs

Hello

How do I concatenate two strings to build a dynamic URL in shown URL?

I want to concatenate my URL with slug. for example xyz.com/ + [slug] I know how to fetch (get) the slug part from the CMS item/source.

I can write a custom function but I don’t know how to create and use it in DivHunt.

Please help as my CMS SEO part is on a halt at the moment. I think you should a function do do this by default anyways if not already.

Thanks

Hey,

If you need to call some variable instead of static text in some inputs/textareas, you can do it like in example below:

https://divhunt.com/post/${page->get('data')->get('slug')}

I explained a process in video below:

One important thing about SEO. If you are checking your canonicals or meta descriptions, or anything else in terms of SEO. Including sitemap, always check it from incognito tab, when you are logged in, Divhunt is not returning you correct data for now.

2 Likes

@Pakic: This is an underrated feature, to say the least :slight_smile:

This functionality is super-useful in almost any field in Divhunt and with a little bit of planning (and practice) you can combine static- and dynamic data anywhere you want:

  • Links
  • Meta titles
  • Descriptions
  • Social share buttons
  • Attributes
  • Dynamic content in running text
  • Placeholder texts in forms
  • etc, etc.

And if you use REST data this data is also available in the same way (almost). It can look a little daunting to “code” at first, but it will change how you handle data when you get the hang of it.

Divhunt has built a truly amazing tool for us to use, and I think we’ve only seen the start of it.

As said, learn this and it will be your superpower when developing your sites :+1:t3:

Thanks for explaining this Pakic.