Favicon to .md files?

So I guess my question is fairly simple. How do you add favicons to .md files? My page uses slate theme, and therefore the index file is a .md. I’ve tried adding this into the head:

 <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">

But it doesn’t seem to work. And changing the index file to index.html from index.md completely hides the slate theme. Any help is appreciated!

Just from a bit of Googling, it looks like Slate is a Jekyll theme for Google Pages? Is that right?

With Jekyll, your .md files are just the content, not the markup for the whole page. Afterall, you don’t have a <head> tag in index.md, right? What you’re looking for is in this file: https://github.com/pages-themes/slate/blob/f54146dea9c46c1fb8d589e49b46efa6eebeb378/_layouts/default.html

In your own installation, make a _layouts/default.html file, copy the contents from the git one, and add your favicon to the head tag in the copy. Jekyll will look for a local version of the file before looking to the theme installation for that file.

I made a _layouts folder with a default.html file inside, with the same code as this: https://github.com/pages-themes/slate/blob/f54146dea9c46c1fb8d589e49b46efa6eebeb378/_layouts/default.html. I changed the index.md file to an index.html and now the slate theme is gone. The favicon is there, but no theme. Did I follow your steps correctly?

Not quite. You should not have changed the .md file to .html.

Outside of Slate, as a whole, Jekyll is a static site generator. It takes the _templates is has, and combines it with your config and other variables, and inserts your .md content to CREATE .html pages. So the index.html that gets viewed in the browser is generated by Jekyll, using index.md as its base. In short, you don’t have to create index.html - that’s Jekyll’s job. I suspect if you change that file extension back to .md, things will work as you expect them to.

After changing it back to a md, everything’s back the way it was, except for the favicon, which is now gone.

Question bump…

Does the generated index.html in your site folder have the favicon in it?

Hi, I’m sorry for the late reply. Yes. It’s in the site folder.