So when making a new website in resources context I always give the website a name. It can be the brandname or my personal name. It’s the name I want to see behind every page title. Like
Pagetitle - Sitename.
But I do not want the pagename to be shown on the homepage like: ‘Home - Sitename’
Here’s how I fixed it. If you have another solution, let me know.
Have you done any (semi-scientific) performance testing to reach the conclusion a snippet would be faster here?
I noticed you said something along the same lines in another thread. While too many output filters are not great, snippets are not without their overhead either, so for a simple conditional like the one in this thread I’d be interested in some data to back up what is the fastest approach.
(Of course you’d want that call to be cached regardless of snippet/output filter, or you’re throwing away all performance benefit)
It’s a good question. I can’t really think of a good way to test it, but I say that for two reasons.
First, the output modifier has to recognize that there are multiple output modifiers. Then parse the full tag. It has to find out which modifier to call (which is basically a snippet call). It has to parse the outer tag, then parse all the inner tags (figuring out what kind of tags they are first). It has to call getOption() for all the System Settings, and get() for the others. Then it has to figure out that it’s an if/then/else structure that’s needed to “solve” the modifier (as opposed to all the other structures that might be requires) and then execute the code. I haven’t looked at it but I’m pretty sure the output modifier parsing code is fairly complex.
The snippet already knows the structure, which variables will be needed, and has essentially no parsing or deciding to do other than the single if statement.
Second, OpenGeek has written more than once about how slow conditional output modifiers are compared to snippets.
It’s quite possible, though that the time differences are trivial. I guess you could use dev. tools profiler to measure the comparative page load times, cached and uncached.