Jekyll layouts looking in the wrong directory - jekyll

I have a new Jekyll site I'm building and I'd like to use some of the configs to alter the folder layout for what will be a large content site.
I'm trying to move all the content into a directory called content and keep the layout and all the core layouts, plugins, etc slightly out of the way of the content.
So my folder structure looks like this:
demo-site:
_layouts:
main.html
content:
index.md
_config.yml
Gemfile
...
My _config.yml is very basic:
source: ./content
layouts_dir: ../_layouts
markdown: kramdown
And my index.md is:
---
layout: main
---
hello world
However, when I run bundle exec jekyll serve I see a warning of:
Error reading file /Users/d2kagw/Desktop/demo-site/_layouts/main.html: No such file or directory # rb_sysopen - /Users/d2kagw/Desktop/demo-site/content/Users/d2kagw/Desktop/demo-site/_layouts/main.html
Clearly, Jekyll is trying to load it from a funky directory tree.
Bug? Or weird quirk with the expected value for layouts_dir?
I'm using Jekyll 3.8.3.

Related

Hugo site, deployed to public/ directory in html, gives weird results

I have a Hugo site with lots of folders and subfolders, containing both _index.md files and many others. It uses the docsy theme.
Running hugo server displays the site correctly in the browser at localhost:1313
When I run hugo or hugo -D to get the same pages as HTML files on the disk, and I get
a set of folders...
... containing only index.html and index.xml files,
but no other files. All the other files are missing.
links look like the raw .md file (example: [VPAT](https://docs.axway.com/bundle/AccessibilityVPATS_allOS_en_HTML5/page/Content/accessibility.htm)
The index.html files are unstyled, unlike the pages generated by the hugo server command.
I don't see how to use the index.xml files.
Here is an example of the files and folders produced by the hugo command:
public/
index.html
index.xml
docs/
index.html
index.xml
admin_intro/
index.html
index.xml
troubleshooting/
index.html
index.xml
...
Here is what the .md file structure looks like
content/
en/
_index.html
search.md
docs/
_index.md
admin_intro/
_index.md
amdin_page_1.md
amdin_page_2.md
amdin_page_3.md
troubleshooting/
_index.md
ts_page_1.md
ts_page_2.md
ts_page_3.md
...
It looks like maybe your postcss process isn't running correctly. I had this problem after upgrading Hugo and Docsy
The postcss process isn't used in the dev mod (hugo server) but it is in production (hugo) so you will unfortunately get different results.
Try running hugo locally with the --debug flag and see if any errors show up.

Jekyll Wiping My Directory

I followed the instructions for Jekyll Quickstart. Whenever I make changes in my site's directory, the changes get wiped somehow. For example, I modified some of the code in index.html, only to have it return to Jekyll's default. I also created a subdirectory in _site called 'otherservices' with an index.html. That gets wiped as well. Any idea why this may be happening? I can't really use Jekyll if it keeps wiping.
Jekyll is a static website generator, each time it generates a website it place files in the _site folder.
Any changes you make inside the above folder are lost because it is recreated when executing jekyll build or jekyll serve .
Changes should be made to the rest of the files or folders so they will be processed and locate the resulting files inside _site.
You should not write manually into _site directory, that is Jekyll's output.
If you need an otherservices directory in the output, place it one level above, like this:
_site/
otherservices/
index.html
index.md
Jekyll will copy every file and directory into _site, which is not excluded in the configuration and doesn't start with _ prefix. Files that have front-matter will be processed in addition to copying. So in result Jekyll will generate this structure:
_site/
otherservices/ (copies it)
index.html
index.html (generates it from index.md)
otherservices/
index.html
index.md
It is worth reading the documentation on how to create custom pages.

Jekyll not finding blog posts

Source Code
I am new to Jekyll and got it installed with Grunt and SASS. My issues is that while my test site will show my new posts, When I click on the post link I get an error "Cannot GET /blog/example-post-name".
Grunt doesn't show any errors when running Grunt Serve. However if I run Jekyll serve I get the following errors:
Build Warning: Layout 'article' requested in app/_posts/2015-01-31-optimized-jekyll-site-with-grunt.markdown does not exist.
Build Warning: Layout 'article' requested in app/_posts/2017-03-20-welcome-to-jekyll.markdown does not exist.
Liquid Exception: Could not locate the included file 'blog.html' in any of ["/Users/rich/jekyll-site/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source. in app/index.html
jekyll 3.4.2 | Error: Could not locate the included file 'blog.html' in any of ["/Users/rich/jekyll-site/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source.
It appears that it cannot find anything in my: _includes, _layouts, ect... folders.
Any help would be appreciated.
Since your template files are in the app/ directory, simply build with app as the source directory.
Add the following to your _config.yml:
source: app
Then run jekyll serve as usual.
Try adding blog.html file in _includes folder or use layout: default in your posts 2015-01-31-optimized-jekyll-site-with-grunt.markdown etc.

Adding Jekyll to an existing website

I have a simple website and tried to add a Jekyll blog in it in a new folder blog thus I have run jekyll new blog in the folder /path. However when I'm running the command jekyll build in /path I have these errors:
$ jekyll build
Configuration file: none
Source: /path
Destination: /path/_site
Generating...
Build Warning: Layout 'post' requested in blog/_posts/2015-06-14-welcome-to-jekyll.markdown does not exist.
Build Warning: Layout 'default' requested in blog/index.html does not exist.
Conversion error: Jekyll::Converters::Scss encountered an error converting 'blog/css/main.scss'.
Conversion error: File to import not found or unreadable: /blog/_sass/base.scss. Load paths: on line 47
I solved the first problem (Configuration file: none) by moving _config.ymlin the parent folder, however I still have problems when requesting layout using
---
layout: default
---
The imports in main.scssare also not working (last error).
If I'm doing the same command jekyll build in /path/blogafter moving again _config.yml, I have no errors. Does someone know how to be able to do a jekyll buildin the parent folder with the configuration I have? Do I have to entirely change the architecture of my website to include a Jekyll blog in it?
You config.yml is in /path with
source: /_jekyll
destination: /blog
baseurl: /blog
Your jekyll sources are in /path/_jekyll.
And you generated files will be in /path/blog.
Ready to deploy !

Jekyll doesn't find _layouts default.html

I just got started with Jekyll, I trying to get it working on my Github site, it loads all posts as it should but it doesn't load the _layouts default.html. As far as I know I have all of the necessary files.
The Jekyll blog
The source code
Anyone that can explain whats going on?
Try moving your _config.yml file from the /blog/ subdirectory to the root directory of the repository, and then add this line to the file:
source: /blog/