I've deployed a Jekyll blog using Github pages, but there appears to be an issue when it generates links for different menu pages.
Here's my _config.yml site settings.
# Site settings
title: Marvin K
description: "Now Loading"
baseurl: " "
url: "marv.ink"
# Build settings
markdown: kramdown
highlighter: rouge
permalink: /:title/
# html minify
compress_html:
clippings: all
comments: all
endings: []
profile: false
# Links to include in menu navigation
links:
section_1:
- title: home
url: /
key_trigger: 1
- title: my posts
url: /posts
key_trigger: 2
- title: series
url: /series
key_trigger: 3
- title: tags
url: /tags
key_trigger: 4
- title: about me
url: /about
key_trigger: 5
# projects in header index
projects:
# exclude my node related stuff
exclude: ['package.json', 'src', 'node_modules']
Any help figuring this out would be great
Thanks
In order to make your menu work on github pages you can :
In _config.yml :
baseurl: "/blog"
...
links:
section_1:
- title: home
url: /
key_trigger: 1
- title: my posts
url: /posts
key_trigger: 2
...
In _includes/menu-search.html, change
<a key-trigger={{ link.key_trigger }}
href="{{ site.url }}{{ link.url }}"> {{ link.title }}</a>
to read :
<a key-trigger={{ link.key_trigger }}
href="{{ site.baseurl }}{{ link.url }}"> {{ link.title }}</a>
This is based on what I saw here.
Related
The original image is located in public/images/properties
The image is looked in the right folder
http://localhost:8000/media/cache/resolve/my_thumb/images/properties/pexels-expect-best-323780-6270d2f4c6366254457078.jpg 404 (Not Found)
but media/cache are not generated by liip_imagine
here is my config
liip_imagine:
# valid drivers options include "gd" or "gmagick" or "imagick"
driver: "gd"
filter_sets:
cache: ~
my_thumb:
quality: 75
filters:
thumbnail: { size: [120, 90], mode: outbound }
allow_upscale: true
and where I apply the filter
<img src="{{ vich_uploader_asset(property, 'imageFile') | imagine_filter('my_thumb') }}" alt=""/>
On my personal site, I style the post list on my home page based on the post's category. So if I have the front matter:
---
layout: post
title: "My Post"
date: 2016-01-26
category: code
---
Because the category is code, the div below will render to have a css class card-code and style the post excerpt accordingly.
{% for post in site.posts %}
<div class="col-1-2">
<!-- This Line! -->
<div class="paper-card card-{{ post.category }}">
<!-- other code -->
</div>
</div>
{% endfor %}
To try to make my life simpler, I set the default category for posts to be general in my _config.yml file:
default:
-
scope:
path: ""
type: "posts"
values:
category: "general"
However, {{ post.category }} comes up with nothing for these posts (i.e., card-). Any ideas why this ain't working?
Reading the documentation at Front Matter Defaults the section should be called defaults not default.
Try this in your _config.yaml
defaults:
-
scope:
path: ""
type: "posts"
values:
category: "general"
First of all, I would like to say I have tried for 2+ hours to try and correct this error, but alas I cannot figure it out. I am also a newbie to Jekyll and Github Pages. However, I am competent in code and can correct any errors.
When I go to my github pages for this repository:
Repository link 2:https://github.com/jeffward01/Conscience-Alchemy.git
Github pages link: https://jeffward01.github.io/Conscience-Alchemy
There is no formating applied. I know/suspect its a problem with my base.url and/or url in the _config.yml file. I have tried 14 combinations and cannot figure it out.
When I run jekyll serve --baseurl it runs and applies the formating/styles... But, when I go to the GitHub pages, it does not...
Does anyone have any tips/advice/answers?
Thanks!!
For your ease, here is my _config.yml file:
`
# Site settings
title: Conscience Alchemy
description: "A blog about Conscienceness and Alchemy"
url: "http://jeffward01.github.io"
author:
name: "Jeff Ward"
email: "conscience-alchemy#gmail.com"
url: "http://jeffward01.github.io"
baseurl: /Conscience-Alchemy
# Build settings
baseurl: /Conscience-Alchemy
markdown: kramdown
source: .
destination: ./_site
permalink: /:title
paginate: 8
paginate_path: /page:num/
# Default values
defaults:
-
scope:
path: ""
type: "posts"
values:
layout: "post"
# Custom variables
version: "1.68"
# Options
custom_header: false
custom_nav_footer: false
reverse: false
'
And here is the beginning of my index.html file (I was not sure if you needed other file so I did not add them. They are on my GitHub Tree tho.)
---
layout: default
---
<!-- Posts -->
<ul id="posts">
{% for post in paginator.posts %}
<li class="post">
<h2>{{ post.title }}</h2>
<time datetime="{{ post.date | date_to_xmlschema }}" class="by-line">{{ post.date | date_to_string }}</time>
<p>{{ post.content | strip_html | truncatewords:50 }}</p>
</li>
{% endfor %}
</ul>
In your _config.yml repository you have baseurl: /, I think you must change it to baseurl: /Conscience-Alchemy.
The baseurl: subpath in the _config.yml file must be pointed to the project's repository name.
Example: baseurl: "/<repositoryname>" or, in this case baseurl: "/Conscience-Alchemy"
I've got a design for my post page that is made up of text and images, more specifically, galleries. Take a look at the illustration below:
I've got these galleries set up my front matter like so:
---
gallery-1:
rows:
- images:
- { url: '1.jpg'}
- images:
- { url: '2.jpg'}
- { url: '3.jpg'}
gallery-2:
rows:
- images:
- { url: '4.jpg'}
- { url: '5.jpg'}
---
Is there a way to print these galleries to the page on my .md file. I know the code below won't work, but something similar?
This is my markdown
[gallery-1]
This is more markdown
[gallery-2]
Is something like this possible with Jekyll?
Any help with this is appreciated. Thanks in advance!
First, let's simplify your yaml front matter :
---
galleries:
# gallery number one
1:
# row one in gallery one
-
- { url: '1.jpg', alt: 'alt 1'}
# row two in gallery one
-
- { url: '2.jpg', alt: 'alt 2'}
- { url: '3.jpg', alt: 'alt 3'}
# gallery number two
2:
# row one in gallery two
-
- { url: '4.jpg', alt: 'alt 4'}
- { url: '5.jpg', alt: 'alt 5'}
other front matter like title, ...
---
Your .md file :
Markdown
{% include gallery.html gallery=1 %}
Other markdown
{% include gallery.html gallery=2 %}
And then the _includes/gallery.html file :
{% comment %}-----------------
- This page receives a gallery index (include.gallery)
- It then assign the gallery[include.gallery] to the rows variable
%}-----------------{% endcomment %}
{% assign rows = page.galleries[include.gallery] %}
{% comment %}%}-----------------
We now loop over rows
%}-----------------{% endcomment %}
{% for row in rows %}
<div class="row">
{% comment %}%}-----------------
and then loop over images in row
%}-----------------{% endcomment %}
{% for img in row %}
<p>src="{{ site.baseurl }}{{ img.url }}" alt="{{ img.alt }}"</p>
{% endfor %}
</div>
{% endfor %}
See yaml documentation And Jekyll template documentation
In my _config.yml I have:
navigation:
- text: Home
url: index.html
- text: About
url: about.html
- text: Blog
url: blog.html
- text: Portfolio
url: portfolio.html
In my default.html layout I have:
<ul class="nav-list">
{% for link in site.navigation %}
{% assign current = nil %}
{% if page.url == link.url %}
{% assign current = 'current' %}
{% endif %}
<li class="nav-list-item{% if forloop.first %}first{% endif %} {{ current }} {% if forloop.last %}nav-list-item-last{% endif %}">
<a class="{{ current }}" href="{{ link.url }}">{{ link.text }}</a>
</li>
{% endfor %}
</ul>
For some reason, this is not working. Why might this be?
I just found out you have to restart the server and run jekyll --server again and the _config.yml variables will be accessible.
Then after figuring it out came back to this page and was about to post this answer, clicked add / show 4 more comments and saw that this was also found out by the op. So posting it as answer.
In addition to the other answer: You can - as you mentioned in your answer - use Ctrl + C to end the currently running server (in your CLI). But, you can as well start the server with
jekyll server -w
to tell Jekyll to watch for changes in your files. Whilst this won't work for changes to the _config.yml, it works for all other files. Note, that this won't work including the --safe option, so you won't get errors. To catch them, I still recommend to run jekyll --safe build from time to time to see if you got syntax errors. The same goes for running jekyll doctor/jekyll hyde sometimes during your dev process.