Linking to relative html files in chapbook to create a 'game hub'

Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2.3.13
Story Format: Chapbook

I’ve made a bunch of small Twine games for local church families for their kids to play on Sundays. I’m making them into a big compilation on Itch.

I’d like to display them by putting them all in one folder with a ‘hub’ game, which is just a single page with links to each game.

However, in chapbook, I can only figure out how to link to external absolute html files or to passages. If I have a file called nephigame.html, for instance, this doesn’t work:

[[Nephi’s Journey|nephigame.html]]

and this doesn’t work:

[[Nephi’s Journy]https://nephigame.html]]

I’m testing by publishing my ‘hub’ to a file then running it in the folder with nephigame.html.

I’ve also tried:

{link to: ‘nephigame.html’, label: ‘Nephi’s Journey’}

which just doesn’t process at all (it displays the raw code).

I’d be happy to just create a regular html page that looks like chapbook and uses a href, but I don’t know how to extract just the css out of chapbook.

Can you not just put the standard HTML anchor link right in your chapbook hub page? It’s not as slick as a markdown link but it should still work, I would think.

I tried opening the html file up and editing it, but all the in-passage stuff seems to go through some pre-processing that alters it.

I’m basically really dumb when it comes to this. Could you give me an example? I may just be wildly misunderstanding or overlooking something.

I just tried it using the online editor and it seems to work.

My code was this:

Link testing.

<a href="http://www.google.com">link</a>

Oh, I see. My problem is I’m trying to link to a relative link in the same folder

So my directory will look like:

index.html
nephigame.html
etc.

And I want the url to go to that relative link.

Edit: wait, I think it might be working…hold on

Edit: It worked! I’m so glad you were able to talk me through it. I wish it were easier for me, but since it’s not, thanks for being so helpful @tayruh ! I just used ‘nephigame.html’ as the href

1 Like

Ah. It’s the same deal then. Just don’t put in the “HTTP”. Even if you host the files online, if you leave out the “http://” part, the browser will assume the files are in the current directory.

Edit:
This also works for folders, so you can do “games/nephigame.html” and keep your directory more organized.

1 Like

Just a follow up to avoid possible issues in the future:

If you do decide to have a structure with multiple directories, you may want to get back to the original hub page with a link. It’s easiest if you imagine it’s like navigating the DOS or Linux command line.

So, say you have a structure like this:

main.html
games/
    game1.html
    game2.html

To get to game1 from main, it’d be games/game1.html. To go back a directory, you’d use the command line-esque .. notation. So to get back to main from inside games1, you’d use a link of ../main.html

I hope that makes sense.

1 Like