Jekyll Posts Not found - yaml

So I setup a Jekyll page, I created a few demo posts, got a navigation between them working and styled it to my liking and then went 'jekyll' in the root.
This generated a _site folder in my root. Awesome.
But when I open this folder in browser, and try to navigate between posts, it attempts to go to file:///2013/02/01/post-title.html instead of the actual location, which would be
file:///blablabla/_site/2013/02/01/post-title.html
I've been looking at Permalinks options in the yml-file, but I havent found a working solution yet.
I use:
<a href="{{page.previous.url}}" title="Previous Post: {{page.previous.title}}">
{{page.previous.title}}</a>
To navigate between posts, and:
{% for post in site.posts limit: 5 %}
{{ post.title }}
{% endfor %}
to link the posts from the main page.
From my config.yml:
baseurl: /
url: http://localhost:5000
source: .
destination: ./_site
permalink: /writing/
Taking any hints here!
Thanks

So what I did was:
In my _config.yml, I added this:
baseurl: /
url: http://some.link.he.re/~nameofdir/big_blog
And for assets like CSS/JS I simply used {{ site.url }} to pre-fix all my actual assets.:
<link href="{{ site.url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />
For navigation I did:
<a href="**{{site.url}}**{{page.previous.url}}" title="Previous Post:
{{page.previous.title}}"> {{page.previous.title}}</a>
In my post.html layout, I added: in the , I am not sure if this is necessary though, but for now it will linger.
For all static pages I added:
<li>Journal</li>
And finally, even though it's the same thing all over, for linking posts:
{{ post.title }}
So {{ site.url }} is the same as what you write in _config.yml at url: xxxx,
And if you're hosting your page on a server that has odd directory structure (like my university for example), you need to give url: the value of the actual root catalog, that means include the blog-folder-name as the last folder in the url. Then just prefix all your links, static or jekyll-generated by {{ site.url }} and you should be cool!

Related

Jekyll – Setting a site wide default layout

I'm trying to set a site wide layout (a header and footer) to my Jekyll project to my config.yml file to no success. I've looked through the documentation and followed what it has said. Why is this not working?
Config.yml
collections:
projects:
output: true
permalink: /:name
defaults:
- scope:
path: ""
values:
layout: "default"
Just having a file named "default"[.html/.md] in the _layouts folder should act as the site wide default layout page. Then the other layout files, if you have any, can inherit the default layout by adding the layout yaml front matter to them.
default.html in _layouts
<!-- default.html -->
{% include header.html %}
{{ content }}
{% include footer.html %}
other layout templates in _layouts:
<!-- _ projects_layout -->
---
layout: default
---

Laravel view won't display after compiling all my assets through laravel-mix

After compiing all my assets through laravel-mix. It displays no error and it went build successful that means all my assets were compiled to the dist/css/ folder.
and I referenced it through
{{ HTML::style('dist/css/auth.css') }}
But i get no display from the view. What's wrong with this ?
Make sure you have HTML package installed via Laravel collective
https://laravelcollective.com/docs/5.3/html
If you did already, try to escape {!! HTML::style('dist/css/auth.css') !!}
Utimately you could go back to the original
<link href="{{ asset("dist/css/auth.css") }}" rel="stylesheet">
Maybe you should try to reference it using relative path:
{{ HTML::style('/dist/css/auth.css') }}
If this doesn't work, try:
<link href="/dist/css/auth.css" rel="stylesheet">
By this, you can determine if the problem was in compiling or HTML package.

Using Liquid tags in a Jekyll page not working

I am attempting to setup a small blog using Jekyll. My work so far is as follows.
Setup a Github pages repository
Cloned the repo locally
Installed Ruby vs 2 and the sdk (windows)
Installed jekyll
'serve' the local website.
Validated that I could view my website localhost:4000
Everything worked fine however the liquid syntax is not working as expected. All syntax is output as plane text. I am not sure how to continue. This error happens both locally as well as on my github hosted page.
Here is my index.html file
<!DOCTYPE html>
<html lang="en-us">
<head>
{% include meta %}{{ site.time | date_to_xmlschema }}
</head>
<body>
{% include header.html %}
{% include header.html %}
{% include header.html %}
{% foo %}
{{ foo }}
<section class="main-content">
{% include footer.html %}
</section>
{% include scripts.html %}
</body>
</html>
My _config.yml has foo defined. =(
If you want Jekyll to process your page, you must add a Front matter to your page (see dedicated page in Jekyll documentation).
The minimum front matter is an empty one. That means that your page will use default configuration for layout, etc ..
---
# this is an empty front matter
---
Your content here

jekyll: Invalid Date: '' is not a valid datetime

I am new to jekyll:
So far I had done what the tutorial has mentioned: This is what I have in _layout: post.html file:
---
layout: default
---
<div class="post">
<h1>{{ page.title }}</h1>
<span class="post-date">{{ page.date | date_to_string }}</span>
{{ content }}
</div>
<div class="related">
<h2>Related Posts</h2>
<ul class="related-posts">
{% for post in site.related_posts limit:3 %}
<li>
<h3>
<a href="{{ post.url }}">
{{ post.title }}
<small>{{ post.date | date_to_string }}</small>
</a>
</h3>
</li>
{% endfor %}
</ul>
</div>
and I use md file with a name 2014-01-01-myNewPost.md and I get the following error:
Generating... Invalid Date: '' is not a valid datetime.
Liquid Exception: exit in _layouts/post.html
I don't seem to see any issues but unable to really figure it out why its not working.
My problem was that for some reason I kept getting this error in the terminal when I ran "jekyll serve --incremental":
Liquid Exception: Invalid Date: 'nil' is not a valid datetime. in /_layouts/post.html
ERROR: YOUR SITE COULD NOT BE BUILT:
------------------------------------
Invalid Date: 'nil' is not a valid datetime.
and after much digging, it's because jekyll picks up posts of any kind in the root directory, even if they are in a whole different folder. I had my posts in "_posts" and my test posts in "old_posts".
Just having the "old_posts" directory at the root project level made this error occur. Make sure you don't have anything like that.
Most likely, you have moved the sample posts to another directory, e.g., examples. Jekyll finds the posts there and tries to process them, which leads to the encountered problem.
Add the examples folder to the exclude list in _config.yml, and Jekyll will start as expected.
Seems like you've a typo in the date variable in your post YAML matter. Check if your post date complies with this format YYYY-MM-DD HH:MM:SS
I've checked the post layout code posted above, its fine.
If nothing works, uninstall Jekyll and install the last stable release 1.2.1 by running these commands
~ $ gem uninstall jekyll
~ $ gem install jekyll --version(="1.2.1")
I had this happen and it turns out I had duplicated a file from my _posts directory by mistake with option-click and it was sitting in the root of my site. Would be nice if the processor would give a detailed description about the cause of the error in addition to the general error message.
Based on this GitHub issue it looks like Jekyll will complain if you label something as a post and then try to format the date if that thing doesn't have a date in the title or front matter. This doesn't happen if you reference {{ page.date }} without formatting it, so it must be some kind of nil error in the format function.
I just had this problem and I realized I'd labeled a bunch of static pages with layout: post in the front matter when the filename was example.md rather than 2016-01-01-example.md. I changed those files to layout: page and that solved the problem.
So at least on my site I have to make sure things without dates are pages and things with dates are posts. (I removed the date from my posts layout when I redesigned the site and just now got around to trying to put it back.)

Why images folder is not copied when generating an Octopress with jekyll-assets blog?

I am building an Octopress blog and I am implementing an alternative search implementation, lunr-search.
This requires an asset pipeline implementation for Jekyll.
My assets, javascripts and CSSs are compiled and combined correctly, but my images folder is not copied to the public folder.
EDIT with further info:
I have my assets under /source/_assets/javascripts, /source/_assets/stylesheets and /source/_assets/images.
The relevant part in _config.yml:
assets:
dirname: assets
baseurl: /assets/
sources:
- _assets/javascripts
- _assets/jwplayer
- _assets/stylesheets
- _assets/images
compress:
js:
css:
cachebust: hard
gzip: [ text/css, application/javascript ]
My compiled and combined assets are generated as expected under /public/assets, under which I can find the app.js and screen.css, however there is no images folder.
Thanks!!
Have you rewritten your source to use Jekyll-Assets to render image paths? In my experience, Jekyll-Assets needs to know you'll be using an asset before it will copy it to the output directory. It will know when you use a corresponding Liquid tag or filter.
According to the Jekyll-Assets readme, URLs for assets that are neither scripts nor stylesheets may be included with the following Liquid tag:
{% asset_path logo.png %}
Additionally, the following Liquid filter is available:
{{ 'logo.png' | asset_path }}: Returns resulting URL for logo.png
Both examples come from the URL above. So in this case the following two lines would be equivalent:
<img src="{% asset_path logo.png %}" alt="Logo">
<img src="{{ 'logo.png' | asset_path }}" alt="Logo">
If you are indeed already doing this, relevant HTML/Liquid source code may prove helpful.
This did the trick for me
{% img /images/logo.png %}

Resources