-
Notifications
You must be signed in to change notification settings - Fork 147
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
Custom URL endpoint w/ SPF #432
Comments
No. spfjs sends query string ?spf=navigate so that in the back end it can decide whether to send the full page or JSON. |
Well it depends on exactly how different. The SPF identifying (?spf=navigate) is configurable by setting the url-identifier field in the global configuration: https://github.com/youtube/spfjs/blob/master/src/client/config.js#L44 Since the default identifier starts with the parameters, that can be replaced by any valid suffix. For example, the demo uses '.spf.json' to reference static files: https://github.com/youtube/spfjs/blob/master/web/assets/scripts/main.js#L142 |
No, I'm looking at trying to implement it against a completely different URL endpoint. e.g. navigate to |
For link clicks, the only currently supported base value is an Lines 176 to 182 in 988b652
However, I think it would be a reasonable extension to allow a data attribute on an element to specify a custom URL, perhaps either <a href="/page-url" data-spf-url="/custom-spf-url">...</a> @DavidCPhillips Any objections? This would break the tight coupling between content served for static/dynamic navigation, but as long as it's not the default behavior, I think it would be okay. |
For my purposes, I'd prefer being able to handle this on the Javascript side, supplying a function that takes the destination URL and returns the API endpoint URL. |
I'd be open to a custom data attribute. For the JS side, we could potentially make the spfrequest event have a more complex configurable response. That would address issue #427 as well. |
If you've got a service worker, it could intercept |
I'm considering using spfjs for a WordPress theme, but I'd like to use the WP-API to return the JSON response, rather than adding custom behavior to the standard URLs, which would mean a completely different URL structure than what spfjs expects by default. Is there a config item or hook I can use to modify this?
The text was updated successfully, but these errors were encountered: