Dynamically selecting design asset to use


(Oleg Voronin) #1

Is it possible to have the same page rendered with different designs, depending on an arbitrary option? Let's say, a specific URL the page is being accessed through, or a get parameter:

 

/some-awesome-page/?design=some-design
 
Edit: I'm actually not after different designs per se, but I want to be able to access /some-awesome-page/?design=blank to retrieve page contents without styles, scripts or any wrapping content at all; if there is a different/better way to do it I'm open to it.

(Anthony Barnes) #2

You can use the query parameter:

/some-awesome-design?SQ_DESIGN_NAME=design

You'll need to setup some user defined designs in the settings screen of the asset you want it applied to. We often do a blank design asset with just a body design area and use it to remove any of the wrapping design HTML from a page.

 

Some other useful ones related to this are:

?SQ_ACTION=set_design_name
?SQ_ACTION=clear_design_name
?SQ_PAINT_LAYOUT_NAME=layout

The first 2 will set and clear the design preference in the user's session. Be careful with this, you don't want to provide a link that might inadvertantly show a crawler the incorrect design for a page.

 

The latter will set a user defined layout name. Similar to the design but it's configured on the lookup settings screen of the asset you want to apply it to.


(Robin Shi) #3

It also depends on where the content is from. It may not come from its content div but a set of metadatas or nested asset listing from the design.


(Oleg Voronin) #4

You'll need to setup some user defined designs in the settings screen of the asset you want it applied to. 

 

I don't think I'm doing it quite right. On the asset I want to have the dynamic design selection enabled, I'm adding this in "Settings" screen (redacted):

 

[attachment=632:Capture.PNG]

 

However when I'm appending "?SQ_DESIGN_NAME=Blank" to the asset URL, it still renders wrapped into the default template.

 

I don't think the feature is disabled in our installation (v.4.14.4), is there anything I could be overlooking?

 

Thanks, I was overlooking the case-sensitive part of the query, passing asset name (Blank) rather than design code (blank) Capture.PNG (4.66 KB)