I’m working on theming an Omeka-S install and I need to know if the current page is the homepage or not. What is the best way of doing this?
Currently I have the following because the only way (that I can see) to work out which is the homepage is if its the first item in the navigation!? but then I’m not able to find the current page slug, only the current site slug.
I know this is an old post… the hackish solution proposed by @hndig above works for me, but I don’t seem to be able to get this working using the page->slug() call, as suggested above.
Uncaught Error: Call to a member function slug() on null in /var/www/html/
If there is no better way I’ll probably stick with the solutions above, but something more elegant would be appreciated, as I suppose that having some custom features on the homepage is not so unusual.
I have not been able to find relevant references in the documentation.
the solution proposed by @hndig was actually breaking the “advanced search page”.
I mildly adapted @hajoki solution above, which is ultimately alright.
In brief, what I currently have is:
<?php $path = $_SERVER["REQUEST_URI"];?>
<? if ($path == "/s/website-slug/page/homepage"): ?>
<p> Something for the homepage</p>
<? else: ?>
<p>Something for all the rest</p>
<? endif; ?>
That’s a workable option… the issue you’re having with what I suggested is that it’s intended to go on the “page” view, omeka/site/page/show.phtml. That’s where the $page variable will be set (and also automatically sidesteps any issues of the markup getting applied on other things than user-created pages).