Search code examples
google-mapsiframegithub-pages

Is it possible to embed a Google Map in a Github pages site?


Does anyone know if it's possible to embed a Google Map using iframe into a Github pages page built using the automatic page generator?

For example, I would like to embed something like this:

<iframe src="https://www.google.com/maps/embed?pb=!1m16!1m12!1m3!1d100921.8397227734!2d-122.50711698562192!3d37.77111185957552!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!2m1!1sGithub!5e0!3m2!1sen!2sus!4v1464784986282" width="400" height="300" frameborder="0" style="border:0" allowfullscreen></iframe>

When I try to embed the above, however, the iframe element appears to be stripped from the final HTML so that no map is shown.

I looked around a bit and couldn't find much information on embedding maps, or in general, using iframe elements in Github pages.

People appear to have luck embedding Youtube videos within an iframe, but the same tweak does not help with the maps.

Any suggestions?


Solution

  • You will not be allowed to insert iframe from the page generator.

    You have to edit your page from, for example, https://github.com/username/repositoryname/blob/gh-pages/index.html, by clicking on edit button (see picture) and insert your iframe code.

    enter image description here