Publish content depending on page url or variable?

In Foundry 3 is there a way to have content in a partial to be published if say on the home page but not on any other page and vice-versa?

This kind of thing would have to be a feature of the Stacks plug-in, rather than Foundry.

Not something that exists at the moment, AFAIK. I think you’d need to have multiple Partials, and be selective where you want them.

1 Like

OK. I use Sitelok from vibralogix and Joe Workman’s associated sitelok stacks. That has the ability to publish content or not depending whether you are logged in or not and so it must be possible. I was hoping to avoid having two alternate copies of my partials but of course, I can do that.

Vibralogix Sitelok is installed and operates entirely independently of RW, Stacks and Foundry. JW’s Sitelok stacks sit inside your RW/Stacks page, and interfaces with the Vibralogix PHP code. As such, it’s using Vibralogix’s independent code to decide whether to display content, or not, based on the user’s login status. JW’s stacks are very clever, but they’re not in charge of the logic.

Foundry can’t possibly control this kind of thing (any more than JW’s companion stacks actually do - the underlying mechanism needs to be there to interface with). Any such logic would have to be built into Stacks API, which is something only Yourhead can implement, although I’m pretty certain it’s nowhere near as simple as you might think.

When you say “it must be possible”, you’re actually comparing Apples and Pears. Conditional display of content based on login status is relatively simple, compared with what you’re looking for (not to mention that there’s an easy workaround, which would make the development time a waste, and might even require each Developer’s stacks to be updated to suit).

EDIT to add: I have a “Master” Partial with everything that needs to be consistent on every page, and then separate Partials for things that need to be consistent on some pages - if these things can be grouped together, then great, otherwise each gets it’s own Partial. It’s a very flexible arrangement, and really takes no more time to create pages, especially if you name your Partials…

1 Like

Is Sidekick an option, using url parameters?

Sidekick site

hey @logrunner, my URL Query Mixer stack will do this for you with the Exact URL child stack. URL Query Mixer | Stacks Weaver

The example shown below would allow you to place this stack in a partial and the rules shown would only show on the homepage of and

1 Like

Brilliant; URL Query Mixer Stack is just what I was looking for.
I have purchased and installed this stack and it is working well and doing just what I wanted.

Thanks to @Stacksweaver for implementing this functionality and the fantastic support. :grinning:

1 Like

Do be aware that by effectively doubling-up your Partials AND adding additional IF…THEN…ELSE logic on each page, you’re bloating both your project file and your site, which will hit performance.

Can’t help feeling this is a solution to a problem that just doesn’t exist :man_shrugging:

PHP is indeed server-side code, so its execution doesn’t add any weight to the site’s performance from the user’s perspective. The concerns raised about performance seem misguided.

For instance, the use of if-then-else logic in PHP doesn’t inherently degrade performance. Major platforms like Facebook rely heavily on PHP for dynamic content generation, yet they manage to deliver personalized experiences efficiently.

While it’s true that hosting quality can impact performance, PHP itself is not the bottleneck in most cases. Personally, I’ve developed complex projects with extensive PHP logic without noticing any significant impact on loading times.

When it comes to performance, other factors like resource-heavy front-end operations or inefficient database queries tend to have a more noticeable effect.

In my experience running a web design firm for over 15 years, I’ve found that it’s often the client-side code, particularly excessive use of media queries for responsive design, that can bloat page loading times. PHP, on the other hand, remains a reliable and efficient server-side solution for dynamic content generation.

Regarding RW performance, if you saw my complex project files, you would see that stacks can handle it.

Looks like @logrunner has marked this as solved so I’m going to close this one now. We seem to be veering off topic.

1 Like