3

Using Jekyll is there a way to save one file to a different directory than what is set in _config.yml as destination?

I'm using Jekyll and github-pages to generate geojson but need that geojson to be saved in a different folder that the rest of the content stored by Jekyll. I need this because I .gitignore the _site folder as recommended but need the .geojson I template out on github to render a map.

DSaeger
  • 51
  • 2
  • I meant destination, not – DSaeger Jun 24 '15 at 03:27
  • Would Javascript redirect help? (https://github.com/jekyll/jekyll/pull/315#issuecomment-1018326) – VonC Jun 24 '15 at 05:50
  • You want to generate your site locally and publish your files to github ? So you don't need github to generate your files ? – David Jacquel Jun 24 '15 at 11:40
  • I dont think javascript redirect would work in this case I need the geojson file which is templated out and clobbered into a .gitignored _site folder to be pushed to github so that github will render it into a map. – DSaeger Jun 24 '15 at 20:23
  • Would it suffice to exclude everything in _site *except* .geojson? – Erik Gillespie Jun 27 '15 at 20:43

2 Answers2

0

Jekyll process all content of your site into the _site folder. You can change the name of this folder, but I don't think this is what your question was.

If you want to relocate your file within the _site folder you can use permalink in your file's front matter.

If you just need the GFM then you may want to use another tool rather than Jekyll. Example here

Community
  • 1
  • 1
Anton Kastritskiy
  • 1,248
  • 1
  • 11
  • 23
0

Check if you need Jekyll to process the markdown page, considering a GitHub page (in markdown) now (March 2022, 7 years later) supports geojson directly:

Mermaid, topoJSON, geoJSON, and ASCII STL Diagrams Are Now Supported in Markdown and as Files

In addition to mermaid diagrams, we now allow users to render maps directly in markdown using fenced code blocks with the geojson or topojson syntax, and embed STL 3D renders using stl syntax.

Additionally, these diagrams are supported as files using their own extensions:

content type supported extensions
mermaid .mermaid, .mmd
geoJSON .geojson, .json
topoJSON .topojson, .json
STL .stl

Example: geojson

```geojson
{
  "type": "Polygon",
  "coordinates": [
      [
          [-90,30],
          [-90,35],
          [-90,35],
          [-85,35],
          [-85,30]
      ]
  ]
}

gives:

https://i0.wp.com/user-images.githubusercontent.com/7219923/158465928-cbe9d7b4-71dd-4f6a-8e2b-9a3ded2c1edf.png?ssl=1

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250