node in URL

Q&A about the latest versions
Post Reply
AleCorreia
Posts: 3
Joined: Mon Feb 08, 2021 1:40 pm

Hi all!!!

How can I make the node name appear after index.html?

I know that I can call a specific node by passing the #node parameter, but I need the opposite, that as I move through the panorama, the node number or another identifier variable appears in the URL for tracking purposes.

Tks! :D
User avatar
k.ary.n
Gnome
Posts: 683
Joined: Wed Aug 15, 2007 1:02 pm

Yes. You can add the name/ID in Custom Node ID in User Data.

https://ggnome.com/doc/dna/#custom-node-id
AleCorreia
Posts: 3
Joined: Mon Feb 08, 2021 1:40 pm

Hello, thanks for the help!

I tried everything and the number of the node does not appear in the browser url :(

I have already activated the show ID of the node in the advanced settings and I have already activated the direct access to the node in the HTML output, what can I be doing wrong? I've tried everything lol
User avatar
Hopki
Gnome
Posts: 13546
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi,
You can show the node id in the browser address bar.
In this example, the tour is in node3.

1.png
1.png (21.78 KiB) Viewed 12929 times

To make this work you need to add a container to your skin and give it the action.

2.png
2.png (33.72 KiB) Viewed 12929 times

For the code just copy and paste the following in the URL text field:

Code: Select all

javascript: history.replaceState({}, player.userdata.title, location.href.replace(location.hash,"") + '#' + player.getCurrentNode());

Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
ismarker
Posts: 29
Joined: Fri Dec 09, 2022 5:07 pm

Hi,

Is there a way to get the custom node name in the url?

I would imagine player.getCurrentCustomNode()); or something like that.

I can't find anything suitable at https://ggnome.com/doc/javascript-api/
User avatar
Hopki
Gnome
Posts: 13546
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi,
Yes you would use: player.userdata.customnodeid.
Put this in a Node Changed, Go To URL action with

Code: Select all

javascript: history.replaceState({}, player.userdata.title, location.href.replace(location.hash,"") + '#' + player.userdata.customnodeid);
Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
ismarker
Posts: 29
Joined: Fri Dec 09, 2022 5:07 pm

Fantastic. Thank you!

Is this documented somewhere?
User avatar
Hopki
Gnome
Posts: 13546
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Have you seen out Javascript API page?
https://ggnome.com/doc/pano2vr/referenc ... cript-api/
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
ismarker
Posts: 29
Joined: Fri Dec 09, 2022 5:07 pm

Nope, I must have missed that one. Thanks again!
daveosaurus
Posts: 19
Joined: Wed Feb 21, 2024 5:37 pm

Hi all / Hopki!

I have just been implementing direct node access -- which is great! -- but have a followup question to the above.

When I test on localhost, the full solution presented above (to use custom node ids, be able to access them directly, and update the url in the address bar) works fine -- both while navigating the tour from the first node, AND when going directly into a node. Great! 🙂

HOWEVER... if I push to my live server, trying to go directly to a custom node id FAILS -- the tour defaults to showing the first node. Navigating through the tour, the URL in the address bar changes to reflect the current node, but if any specific node id URL is copied and pasted, the tour returns to the primary node. Unexpected?! 🤔

If I REMOVE the action using 'player.userdata.customnodeid', then manually entering a custom node id DOES go to that specific node, BUT THEN navigating the tour DOES NOT update the URL in the address bar. Which is somewhat confusing!

I don't understand this difference in behaviour between localhost and a live server.

Is there a solution which allows direct access to a specific node AND keeping the URL custom node ID updated as the person navigates from the custom node where they entered on a live server (not just localhost)?

Thanks!
David.
User avatar
Hopki
Gnome
Posts: 13546
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hello David,
It would help to have a better understanding of the project.
To this end, can you send your project to support without any workarounds, so how it should be.
We can then build and upload the output from the project to our test servers to see if we can reproduce the issue.
Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
daveosaurus
Posts: 19
Joined: Wed Feb 21, 2024 5:37 pm

OK, problem solved! Thanks to Hopki for the help to troubleshoot this one behind-the-scenes.

It turns out that uploading a GGPKG file to a WordPress site and using the GG WordPress plugin to display the tour doesn't include the functionality (code) for Direct Node Access -- which made sense when it was pointed out to me.

An embedded tour on a web page won't change nodes when you add a #node-id to the URL, because the URL is for the web page, not the tour.

What had further confused me was that I'd been taking this approach BUT also making the tour take up the whole viewport/browser window, so it FELT like I was loading only the tour... when I wasn't. It was still embedded in a (otherwise empty) web page.

The way I got DNA working was to upload the local /output/ folder's content to a new folder on the server and access the index.html file within, which DOES have the code required for DNA to work.

Thanks again Hopki! 🙇‍♂️
Post Reply