The collection is declared in _config.yml and set to generate standalone content:
Then I drop .gpx files in _traces and simply add a front-matter with the custom layout:
The layout is a bit more complex, it needs to
import Leaflet (which I personally checkin in my blog repository rather than using the hosted version to be standalone)
drop content (which is the gpx trace) in a script tag rather than in the body
display the expected page with an empty div in where the map is to appear
For my case I also added custom tags in the front-matter like the duration and the type of race. The layout displays them directly in the served HTML and it is indexed.
## Github pages
Not using a custom plugin theorically allows to directly use Github pages to generate the site and simply push sources to there. Though the version of Jekyll currently supported by Github pages is too old so in the meantime I use the following makefile to manually push to it:
What I really like in this solution is being able to display traces with natively in Jekyll, no real hack there. An important aspect to the solution is that the gpx track itself is embedded in the page, not need to fetch it asynchronously.
On the bad side, it may be harder to use that to include a trace in the middle of a post, in my case traces are standalone items, but the solution may not apply if mixed with text.