pages-themes / slate

Slate is a Jekyll theme for GitHub Pages
https://pages-themes.github.io/slate/
Creative Commons Zero v1.0 Universal
303 stars 981 forks source link

Cannot preview the theme locally #11

Closed kyao233 closed 6 years ago

kyao233 commented 7 years ago

HI, I configured my _config.yml and Gemfile as directed, but when I run

bundle exec jekyll serve

I got these error?

Configuration file: /home/kyao4/kyao4.github.io/_config.yml
Configuration file: /home/kyao4/kyao4.github.io/_config.yml
            Source: /home/kyao4/kyao4.github.io
       Destination: /home/kyao4/kyao4.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
     Build Warning: Layout 'post' requested in _posts/2017-05-20-welcome-to-jekyll.markdown does not exist.
  Liquid Exception: Could not locate the included file 'icon-github.html' in any of ["/home/kyao4/kyao4.github.io/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source. in about.md
jekyll 3.4.3 | Error:  Could not locate the included file 'icon-github.html' in any of ["/home/kyao4/kyao4.github.io/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source.

Can someone explain to me why this is happening?

asbhat commented 7 years ago

@kyao4, this error does not seem to be related to the slate template.

It looks like you have a line in your 'about.md' file similar to:

{% include icon-github.html %}

so jekyll is looking for an 'icon-github.html' file in your "/_includes" folder, which doesn't exist. If you find the above line of code and take it out, you should stop seeing that error. For more on how the include tag works check out the jekyll docs.

The slate template does not have any reference to this file, so it's probably from something else you're using or trying to do.

Hope that helps.

kyao233 commented 7 years ago

@asbhat Oh, Your answer is indeed helpful.

I used command jekyll new myblog to create my blog. and then edited _config.yml and Gemfile accordingly.

I think what I should've done is to clone this repo and customize it by myself?

asbhat commented 7 years ago

@kyao4, you can certainly clone the repo, but that's probably not what you want if your goal is to use GitHub Pages. I would recommend you first go through this guide.


Original comment: ah, I see what you did now. Yes I can recreate this error.

Are you on macOS? If so, do

$ open $(bundle show minima)

This will open a finder showing you all the files within the minima gem (the default theme). Navigate to the "_includes" folder you see. You can copy all of those files to an "_includes" folder in your "myblog" folder. There's more information on handling theme changes here: https://jekyllrb.com/docs/themes/

Taking a step back, I would suggest you first go through this guide that jekyll recommends: http://jmcglone.com/guides/github-pages/

Not recommended hacky way to get your current page up and running

  1. Copy the "_includes" files as detailed above
  2. Copy the 'home.html' and 'about.html' files from the minima "_layouts" folder into your "myblog/_layouts" folder
  3. $ open $(bundle show slate) and copy the 'default.html' file from that "_layouts" folder into your "myblog/_layouts" folder
  4. $ bundle exec jekyll serve should work
  5. If you get an error about "No repo name found" you could do something like $ PAGES_REPO_NWO=pages-themes/slate bundle exec jekyll serve
stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.