@Nipun-Kataria via a plugin, yes. There are hooks for you to add meta tags to specific pages.
Why does data.url report as undefined? (How to determine the page URL)
-
Would you help teach me why
data.url
is reporting back asundefined
?This is my code snippet:
$(window).on('action:ajaxify.end', function(data) { console.log('url is ' + data.url); });
The output in my browser console is:
url is undefined nodebb.min.js:15:22076
Edit: My goal is to determine the URL of the "page" that the user is currently at.
Thank you.
-
Try
$(window).on('action:ajaxify.end', function(ev, data) { console.log('url is ' + data); });
-
This:
$(window).on('action:ajaxify.end', function(ev, data) { console.log('url is ' + data); });
produces this:
url is [object Object]
-
Should be
data.url
-
@rod do you have a public url where this can tested, it shouldnt be undefined
-
@baris with
data.url
it I get no result:url is nodebb.min.js:15:22078
-
Does it matter that I am "high jacking" the Google Analytics plug in for my testing? Editing the
node_modules/nodebb-plugin-google-analytics/lib/client.js
file? -
-
If url is empty you might be on the forum index. Is it empty on other pages as well?
-
@baris @bentael helped me out last night. Amongst other things he confirmed that too, that being on the index page results in an empty
data.url
. He did get me going using thelocation.href
.I have to say every one on this forum has been super helpful. I intend to make a donation to Nodebb in the near future.