Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

link to an external site in the sidebar?

Hey there -- I'm using sugarcube -- how can I link to an external site (like my other webpage) in the side bar?

Thanks!

Comments

  • SugarCube allows you to use a special passage named StoryCaption to add content to the side-bar.

    To display a link you could use either the markup link or the <<link>> macro.

    (warning: If you use the markup link then Twine 2 will incorrectly create a new passage titled whatever your URL is, you need to delete this new passage.
    note: Using TWEE notation, line starting with two colons represents a new passage, text following the two colons is the new passage's title.)

    :: StoryCaption
    [[Google|"http://google.com/"]]
    <<link "Google" "http://google.com/">>
  • Hate to be dense, but I plugged that into my stylesheet and it didn't do anything. (And then I spent a fair amt of time trying to figure out other ways to make it work.)

    Is there another way to do that? Preferably in the style-sheet, since I know how to get to that? Thanks so much -- this is the last thing I need to do before I can make my game live.
  • To clarify my previous post:

    1. Create a new passage titled StoryCaption

    2. Add to the contents of your new StoryCaption passage a link to the external site.

    You can either use a markup link like the following:

    [[Google|"http://google.com/"]]
    Or you can use the <<link>> macro:

    <<link "Google" "http://google.com/">>
    3. Test your story and you should see a link within the side-bar that points to the external site.
  • YES.

    Thank you so much!!!!
  • greyelf - I am having trouble replicating what you have shown above in Twine 2.1.2 with Sugarcube 2.18 running on a Mac. Using the <<link (macro as you show) and ended with <</link>> the error message " Error: the passage "http://google.com/"; does not exit " pops up. Just wondering if there is a syntax change for 2.18?

    Second, the error messages are really hard to see - where should the css changes for the debug messages be made to enable better viewing?

    Thanks
  • Never mind on the question above about using <<link macro. I accomplished the linking I wanted by putting in another passage the URL using Javascript. I linked then from a passage that had javascriptLink in it and I made a passage called javascriptLink containing only <<script>>
    window.open("https://www.google.com";);
    <</script>>
    That opened a new window when click google in the twine passage leaving the twine window intact.
  • Never mind on the question above about using <<link macro. I accomplished the linking I wanted by putting in another passage the URL using Javascript. I linked then from a passage that had javascriptLink in it and I made a passage called javascriptLink containing only <<script>>
    window.open("https://www.google.com";);
    <</script>>
    That opened a new window when click google in the twine passage leaving the twine window intact.

    Why not just
    [[Google|http://google.com]]
    
    ?

  • greyelf - I am having trouble replicating what you have shown above in Twine 2.1.2 with Sugarcube 2.18 running on a Mac. Using the <<link (macro as you show) and ended with <</link>> the error message " Error: the passage "http://google.com/"; does not exit " pops up. Just wondering if there is a syntax change for 2.18?
    No change. Neither the <<link>> nor <<button>> macros have ever supported external links.

    Never mind on the question above about using <<link macro. I accomplished the linking I wanted by […]
    Doing something wildly overcomplicated. You really don't need to do that to open an external link.


    Your two simple options are are using a wiki link or a <<link>> wrapping a <<script>> to call window.open().
    → Wiki link (a.k.a. double square bracket link)
    [[Google|https://www.google.com]]
    
    → <<link>> + <<script>>
    <<link "Google">><<script>>window.open('https://www.google.com')<</script>><</link>>
    
  • Just wondering if there is a syntax change for 2.18?
    The 2.x <<link>> macro documentation makes no reference to supporting external URLs so I can only guess that it doesn't now, and my tests confirm that guess.

    I agree with @Chapel that using a markup-based link would be a better solution than the <<script>> macro based one you are using.
Sign In or Register to comment.