"Could not locate the included file" error - ruby

I am practicing with Jekyll building a little website from scratch. Unfortunately, the following command returns error:
rodolfocangiotti.github.io rodolfo$ bundle exec jekyll serve --incremental --host=0.0.0.0
Here is what is printed to stdout:
Configuration file: /Volumes/Data HD/Jekyll Folder/rodolfocangiotti.github.io/_config.yml
Source: /Volumes/Data HD/Jekyll Folder/rodolfocangiotti.github.io
Destination: /Volumes/Data HD/Jekyll Folder/rodolfocangiotti.github.io/_site
Incremental build: enabled
Generating...
Liquid Exception: Could not locate the included file 'bodyheader.html' in any of ["/Volumes/Data HD/Jekyll Folder/rodolfocangiotti.github.io/_includes", "/usr/local/lib/ruby/gems/2.4.0/gems/minima-2.1.1/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source. in /_layouts/default.html
jekyll 3.6.2 | Error: Could not locate the included file 'bodyheader.html' in any of ["/Volumes/Data HD/Jekyll Folder/rodolfocangiotti.github.io/_includes", "/usr/local/lib/ruby/gems/2.4.0/gems/minima-2.1.1/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source.
Actually, the bodyheader.html file is inside the _include folder. Is anyone able to explain why Jekyll is unable to locate that file and how to solve the issue?
UPDATE:
The bodyheader.html file is included inside the default.html file, which is located inside the _layouts folder. Here is the content of that file:
<!DOCTYPE html>
<html>
{% include head.html %}
<body>
{% include bodyheader.html %}
{{ content }}
</body>
</html>

Try to rename _include folder to _includes.

Related

Empty CSS files generated through asset pipeline

Problem:
I have a Hugo site with pretty standard setup. It uses asset pipeline to process SASS. It imports bootstrap, font-awesome, and also uses resources.ExecuteAsTemplate (please do check out main.css file). CSS resources are being generated properly (I checked resources/_gen/assets/scss/sass) but the .css file in public directory is an empty file. I am not able to find any problems in the code. See the code here, site here. I tried creating a new project with same head.html file and .scss files, and it generated CSS resources, and had them in the public directory properly.
Additional info:
Related files:
head.html
main.scss
Currently, I am not using PostCSS; just have the config file created. Would be replacing minify with postCSS on line 13 in head.html once empty .css file problem is solved.
Output of hugo version:
Hugo Static Site Generator v0.57.2-A849CB2D/extended linux/amd64 BuildDate: 2019-08-17T17:57:54Z
I would gladly provide any additional information if required. Please help!
In the head.html file, link tag is:
<link rel="stylesheet" integrity="{{ $css.Data.Integrity }}" href="{{ $css.Permalink }}">
Changing the link tag with following:
<link rel="stylesheet" href="{{ $css.Permalink }}" integrity="{{ $css.Data.Integrity }}">
fixes the issue.
It seems that Hugo requires user to first call .Permalink of the asset and then only other related functions or variables.
See related discussion on Hugo Discourse here.

Having problems building github page(SCSS import fails (Jekyll))

I was trying to run a github page with Jekyll theme,and the website runs fine locally. However, when I try to urn in on htttps://username.github.io, GitHub cannot build the website.
I got the following error message :
Your site is having problems building: Your SCSS file myblog/assets/main.scss has an error on line 1: File to import not found or unreadable: minimaless.
The main.scss :
---
# Only the main Sass file needs front matter (the dashes are enough)
---
#import "minimaless";
It seems to be the path to the .scss file expected by GitHub is different from where the Jekyll theme put it. I checked some posts mentioned that I should put the absolute path of .scss in _config.yml file.
It seems to be the path to the .scss file expected by GitHub is different from where the Jekyll theme put it. I checked some posts link mentioned that I should put the absolute path of .scss in the directory of urlbase, which is /myblog. But I am not familiar with ruby, so I am not sure how should I do it.
The folder structure is like this :
myblog/
- assets/
- main.scss
- _sasss/
- minimaless.scss
- minimaless/
- basic.scss
- layout.scss
- hight-lighting.scss
- _config.yml
This is my GitHub page folder :
https://github.com/Po-Hsuan-Huang/Po-Hsuan-Huang-github.io
The issue could be because your source contents are within a subdirectory myblog. Try moving all the contents to the root of your repository.
It could also be because of the following in your config file:
theme: minimaless
#remote_theme: brettinternet/minimaless
theme: minimaless is not supported on GitHub Pages. Comment it out.
And finally, _site directory should not be checked into version control. Delete it from your repository and then add an entry for it in your .gitignore file.

Can't seem to get Jekyll to see posts that are in subdirectories from the root folder

I have used collections in my Jekyll website for GitHub Pages. I'm trying to get Jekyll to see the Markdown files inside the collection folder, _projects.
Here's a rundown of the file structure:
root
│
├─ _projects
│ │
│ ├─ project_1.md
│ └─ project_2.md
│
└─ /*Rest of the Jekyll folders and files, _posts, _includes, etc.*/
At the moment, I realized that you must put the Markdown files in the root, so Jekyll can be able to see and parse the files to display them when after you clicked a link that points to them via permalinks. But it cannot "see" the Markdown files if the files are not in the root folder, after testing quite a while.
Is there a way to let Jekyll see and parse files inside the subfolder, _projects, just like how it can see files in the root folder? Maybe I need to set something up in the _config.yml, I guess?
Thanks in advance.
Edit : My first answer was completely wrong. I was talking
_config.yml
collections:
project:
output: true
_project/project_1.md
---
layout: project
title: project
---
## Yo!
Project in **strong** yo `inline code`
some code
yolo !
_layouts/project.html
<!DOCTYPE html>
<html>
{% include head.html %}
<body>
{% include header.html %}
<div class="page-content">
<div class="wrapper">
{{ content }}
</div>
</div>
{% include footer.html %}
</body>
</html>
You now have a project/project_1.html page.
No need to use include: parameter in order to Jekyll to see collection folder or subfolder.
exclude: parameter can be used to ignore a subfolder in the collection.
End Edit
Old answer (nothing to do with collection)
Your _project folder is ignored by Jekyll, just like any underscored folder
To force Jekyll to parse files in this folder, in your _config.yml you can add :
include:
- _project
jekyll build and all is good !
The OP tom-mai78101 comments the the article "Jekyll Blog From a Subdirectory" from Hemanth.HM
has confirmed my guesses that subdirectories are only defined by the permalinks in the Markdown files, and not through the folders within the repository.
I quickly wrote a code snippet, and created a few Markdown files shown here, I am now able to create webpages using Markdown files nested within the _posts folder.
In short, there's no need to use collections in the _config.yml, and just use the default _posts.
It would've been better if there is a way to change the default permalink setup in the _config.yml.
The question "Jekyll not generating pages in subfolders" could be relevant, in order to make some pages being generated in a subfolder.
Or you could use a different baseurl. (Jekyll 1.0+)
Or use the _include folder (see "Jekyll paginate blog as subdirectory")
Or, The article "Running Your Jekyll Blog from a Subdirectory" (from Josh Branchaud) seems to address your situation:
Solution 1
Create a directory called blog in your public html directory (that is, in the directory that your domain points to).
Assuming you are using some sort of deployment scheme (GitHub pages or deployment methods), you need to have that deployment scheme tell Jekyll to deploy to the blog directory instead of the directory it is currently using.
(in your case blog would be projects)
Solution 2
Start by creating a directory locally where you have your Jekyll blog setup.
This directory will sit along side _posts, _site, css, etc.
This is only going to hold non-post files such as index.html.
The blog posts will still go in the _posts directory.
Next, we are going to tell Jekyll that we want it to take our blog posts and put them inside a directory called blog when it generates them.
This can be done by adding a permalink setting to the _config.yml file.
Add a line like this to the top of the file:
permalink: /blog/:categories/:year/:month/:day/:title.html.
The default (which you have probably been using) puts posts in a directory structure starting with the category, followed by the date, and finally with the title of the blog post as the name of the html file.
Which, spelled out would be
/:categories/:year/:month/:day/:title.html.
Does that look familiar? Sure does. It is what we have used above, sans the /blog part.
We are essentially emulating the default directory structure and while adding our blog directory at the beginning.
Lastly, you are going to want to add an index.html file to the blog directory that you created.
This way, when a person goes to mydomain.com/blog/ they can see what blog posts you have to offer.
This index page is going to more or less mirror exactly what you had setup originally for listing your blog posts.

Symfony 2 compass with assetic on Windows XP

I try to install Compass in my Symfony 2.3.1 project on Windows XP though not successfuly up to now.
I have Ruby, compass, sass the newest versions installed.
This is my assetic configuration in app/config/config.yml
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
#bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
sass: ~
compass: ~
Here is my app/cofnfig/parameters.xml
# Assetic
assetic.filter.compass.images_dir: %kernel.root_dir%/../web/images
assetic.filter.compass.http_path: /images
assetic.filter.compass.bin: C:/Ruby200/bin/compass
The block code including stylesheets section in app/Resources/views/base.html.twig
{% stylesheets filter="compass"
"#PortalSlubnyMainBundle/Resources/assets/css/main.sass"
"#PortalSlubnyMainBundle/Resources/assets/css/header.sass"
"#PortalSlubnyMainBundle/Resources/assets/css/footer.sass"
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
Ok so when I try to compile this from command line as a result of this command php app/console assetic:dump I get output below:
Dumping all dev assets. Debug mode is on.
17:46:14 [file+] C:/xampp/htdocs/slub/app/../web/css/12c97a7.css
[Assetic\Exception\FilterException] An error occurred while
running: "C:\Ruby200\bin\ruby.EXE" "C:/Ruby200/bin/compass"
"compile" "C:\Documents and Settings\piotr\Ustawienia lokalne\Temp"
"--images-dir" "C:/xampp/htdocs /slub/app/../web/images" "--config"
"C:\Documents and Settings\piotr\Ustawi enia
lokalne\Temp\ass1C9.tmp" "--sass-dir" "--css-dir" "C:/Documents and
Settings/piotr/Ustawienia lokalne/Temp/ass1CA.tmp.sass"
Error Output: You must compile individual stylesheets from the
project directory.
Input: html, body {
overflow-x: hidden;
background-color: yellow;
}
assetic:dump [--watch] [--force] [--period="..."] [write_to]
Ruby is working from cmd and it is set in the PATH environment variable as well as compass. Guys any help would be fully apreciated.
EDIT:
Thanks for the answer unfortunetly it doesnt help me either.
When I changed names to bundles/portalslubnymain/css/main.sass CLI return me error sth similar to that this file is unable to find, thogh the paths to files seem to be ok
I followed instructions form the article you posted earlier I also checked this article
Looking at your code i suggest you followed this article. please notice the UPDATE notice at the end!
At first your assets should live in the Resources/public folder ...
... not in Resources/assets. fix this...
Afterwards please change ...
{% stylesheets filter="compass"
"#PortalSlubnyMainBundle/Resources/public/css/main.sass"
"#PortalSlubnyMainBundle/Resources/public/css/header.sass"
"#PortalSlubnyMainBundle/Resources/public/css/footer.sass"
... to
{% stylesheets filter="compass"
"bundles/portalslubnymain/css/main.sass"
"bundles/portalslubnymain/css/header.sass"
"bundles/portalslubnymain/css/footer.sass"
... because some assetic filters ( i.e. cssrewrite ) are known to NOT work with the #-syntax.
Afterwards symlink your assets into the web dir like this:
app/console assets:install web --symlink
Finally you should be able to run
app/console assetic:dump

How can I find the path to an include in Symfony2?

I've looked thoroughly over Symfony related questions on this site but can't find the answer I need.
I'm using Symfony 2.0.9 with PHP 5.3.6 and my file structure looks like this:
src/
Blog/
TestBundle/
Resources/
views/
Default/
index.html.twig
header.html.twig
Inside of index.html.twig I have:
<div id="header">
{% include "BlogTestBundle:Resources:Default:header.html.twig" %}
</div>
It keeps erroring out with
Twig_error_loader: Unable to find template
no matter what I use for the path. Why isn't it finding the file? They're even in the same directory!
Anyone have any idea what I'm doing wrong?
twig file includes should follow the format below:
FullBundleName:ControllerName:filename
You can also amend parts if they're not present, i.e. for just a file under a bundle /views directory you can use FullBundleName::filename
So in your case, use BlogTestBundle:Default:header.html.twig

Resources