Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$current_path for index page #1392

Closed
pixelninja opened this issue Jul 22, 2012 · 6 comments

Comments

Projects
None yet
4 participants
@pixelninja
Copy link

commented Jul 22, 2012

Not sure what the desired output is for most people with the current-path param and the index page, but currently it is an empty string. This makes filtering by current-path for the homepage impossible, which is vital for SEO and some DS filtering etc.

I changed line 320 of class.frontendpage.php to read $current_path = rtrim(current($split_path), '/') == '' ? '/' : rtrim(current($split_path), '/'); so that way is checks if it's empty and makes it '/' instead.

@brendo

This comment has been minimized.

Copy link
Member

commented Jul 27, 2012

Is it possible to use $current-page-id instead of $current-path? Alternatively {$current-path:/} should give the same result?

I'm cautious about this change as it may be breaking for some sites (filtering when $current-path is empty).

@michael-e

This comment has been minimized.

Copy link
Member

commented Jul 27, 2012

Yes, it's a breaking change, but it has some logic. $current-path always includes a leading slash.

@brendo

This comment has been minimized.

Copy link
Member

commented Jul 28, 2012

It could be a little more complex then that. If a DS filter evaluates to '' (an empty string), the filter is void, and no filtering will take place (all entries), so changing the $current-path to be always be / won't trigger this fallback behaviour, instead it will filter all entries that equal /.

However, I would consider that a fairly minor use case, and for the most part adding a / to your XSLT logic would be pretty straightforward as there is no other way that can occur.

@pixelninja

This comment has been minimized.

Copy link
Author

commented Aug 1, 2012

yea current-page-id works, thanks. That was too obvious for me haha

To me it seems illogical that current-path is empty. Even when on the root page there is still a valid path, so that's why I raised this issue. But if that's intended behaviour then I'm fine with it now I know a couple of alternatives.

Thanks!

@designermonkey

This comment has been minimized.

Copy link
Member

commented Aug 2, 2012

$current-path is either blank or /page-name, whereas $parent-path is either / or /parent-page.

A little inconsistent in my eyes. We need to iron out these inconsistencies and make a unified approach to url stings etc.

Personally, I vote for making this / by default instead of blank. I'm sure that we can sort out the fallback to treat / the same as an empty string.

@ghost ghost assigned brendo Aug 2, 2012

@brendo

This comment has been minimized.

Copy link
Member

commented Aug 2, 2012

Right in this case we should definitely be consistent, and considering as in most cases the $current-page-id will produce the same result (assuming we're talking about the Pages Field) then there is an update path for users (and as @michael-e said, the logic is not difficult)

@brendo brendo closed this in 709fc75 Aug 3, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.