github pages remote theme not working
Asked Answered
N

1

7

I have created a repository level github page in the root directory of my project. This works fine, and after a small build interval, the index.html page is served as expected at https://erikor.github.io/myrepo/

Now I am trying to use the dyutibarma/monochrome theme.

Per this post, I, somewhat naively, thought that all I needed to do was to put this in my _config.yml:

remote_theme: dyutibarma/monochrome

But the resulting page clearly expects some theme related resources to be in my repo, not the remote theme repo. For example:

<link rel="stylesheet" href="/myrepo/css/main.css">

And thus, my page is not styled properly.

Is there a way to point github pages to the remote theme resources, or is the only way to accomplish this to fork the theme, build it, and then add my content? I was hoping to avoid that every time I want to switch themes if possible, particularly after reading the above referenced post about remote themes.

Thanks in advance, Eric

Nonsuch answered 28/3, 2018 at 14:57 Comment(2)
I've just tried to get jekyll-remote-theme working, but I gave up after 15 minutes debuging this mess. Best option is to download a theme and to code around it.Inhumation
I wasn't able to get remote_theme to work either with a different theme that I'm trying to use. Nice to hear that I'm not the only one that wasn't able to get this to work :)Examinant
C
6

The dyutibarma/monochrome theme is not jekyll-remote-theme compatible. For example: it has the "css", "img", "js" folder in it's root directory. Those folders will not be deployed when used via remote_theme. They must be moved within an assets folder in order to be deployed. I just created a PR for an other theme to be jekyll-remote-theme compatible and published a working demo on github.

Never fork a theme! A GitHub fork can not be changed later. So when you want to change the theme later on the fork will always point on your first theme. When the theme is not jekyll-remote-theme compatible just clone it and push it as a self-standing repository. Add the theme base repository as upstream to fetch bugfixes and new features. I have written a blog post about this.

BR

Cobble answered 5/12, 2018 at 17:49 Comment(5)
This is a really helpful answer, however I have a theme that I want to make jekyll-remote-theme compatible and I don't understand where in the linked documentation I should look. Is there not just a standalone spec? ThanksRode
A "remote theme" is just a theme published as a Github repo. Make sure your files are in the correct folders and you should be good. More information on themes here: jekyllrb.com/docs/themesCobble
'Make sure your files are in the correct folders' is what I don't understand do you mean in _layouts etc? - there is not a description of this in the linkRode
yes there is: Jekyll will look first to your site’s content before looking to the theme’s defaults for any requested file in the following folders: assets, _layouts, _includes, _sass.. So it appears all theme files have to be in one of those folders. You can try out the > jekyll new-theme themename command as well to see how themes are structured. Then simply publish on github and use as remote-theme.Cobble
Thankyou - I have also just found that I was using jekyll-remote-theme incorrectly in my Gemfile and _config and hence getting an error that a valid repository was not in the correct format. If I need to inspect in the future however what you said about > jekyll new-theme themename sounds like a clever idea to interactively inspect the standard core structureRode

© 2022 - 2024 — McMap. All rights reserved.