Link path handler for arbitrary content

10 views
Skip to first unread message

Samuel Lotz (salotz)

unread,
Nov 27, 2022, 9:19:27 PM11/27/22
to nikola-discuss
Hello,
Hopefully a stupid question.

I want to put a Godot HTML5 game build into my site. So I have a folder with all of the assets and a `game.html`. I used the `FILE_FOLDERS` to get it into the `output` and can confirm that it works by knowing the URL directly. I want to be able to link to it from other pages though and I can't find how to do this.

I have this structure:

```
demos/
  game.md
  game/
      game.html
```

and conf.py

```
PAGES = (
  ("demos/game.md", "demos", "page.tmpl"),
)

FILE_FOLDERS = {"demos": "demos"}
```

And the URL `https://my-domain/demos/game/game.html` has the game.

The `demos/game.md` generates the `https://my-domain/demos/game/index.html` fine.  

I tried the path handlers for `filename` and `root` as links in `game.md` e.g.:

```
[PLAY](link://root/demos/godot-2d-creeps/creeps.html)
```

Which doesn't resolve and points to the main page.

and

```
[PLAY](link://post_path/demos/godot-2d-creeps/creeps.html)
```


Any ideas on how to link to the `game.html` without hardcoding in my domain name?

Thanks,
~Sam


Roberto Alsina

unread,
Nov 28, 2022, 7:40:26 AM11/28/22
to nikola-...@googlegroups.com
Just use /demos/game and nikola will make it work :-)

--
You received this message because you are subscribed to the Google Groups "nikola-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nikola-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nikola-discuss/d3852ab0-8255-493a-8a83-4221caeca977n%40googlegroups.com.
Message has been deleted

Roberto Alsina

unread,
Dec 2, 2022, 6:16:50 AM12/2/22
to Nikola—Discuss
I guess I don't really understand the question, so here is the general solution:

Check your output folder. See where your target is. Use that path.

So if it's in output/a/b/c/x.html you should use /a/b/c/x.html

If the name of the file is index.html you can leave it out.

On Fri, Dec 2, 2022, 8:13 AM Samuel Lotz (salotz) <samue...@gmail.com> wrote:
> Just use /demos/game and nikola will make it work :-)

Nice didn't know this. This isn't actually mentioned in the documentation.

However it still doesn't work. If I have this:

```
[PLAY](link://demos/godot-2d-creeps/creeps.html)
```

Then in the rendered web page I get the URL `http://127.0.0.1:8000/demos/godot-2d-creeps/#`.
Reply all
Reply to author
Forward
0 new messages