I want to create an online resume with GitHub pages and Jekyll. I'm using the Minimalist theme.
It comes with a sidebar link to my GitHub account. However, because I have created an organisation for the purpose of getting a custom address (myname.github.io instead of myusername.github.io). This means that it links to that organisation, but I want it to link to my account.
How can I do this?
As suggested in the project with the additional step to change the link:
Copy the original template from the theme's repository
(Pro-tip: click "raw" to make copying easier)
Create a file called /_layouts/default.html in your site
Paste the default layout content copied in the first step
Change the following section to reflect your needs and show the link you want:
<h1>{{ site.title | default: site.github.repository_name }}</h1>
<p>{{ site.description | default: site.github.project_tagline }}</p>
{% if site.github.is_project_page %}
<p class="view">View the Project on GitHub <small>{{ github_name }}</small></p>
{% endif %}
{% if site.github.is_user_page %}
<p class="view">View My GitHub Profile</p>
{% endif %}
{% if site.show_downloads %}
<ul>
<li>Download <strong>ZIP File</strong></li>
<li>Download <strong>TAR Ball</strong></li>
<li>View On <strong>GitHub</strong></li>
</ul>
{% endif %}
Related
As mentioned in the Jekyll docs here, I have the following in my _config.yml as:
collections:
sections:
order:
- introduction.md
- battery-state.md
- vibe.md
- references.md
To render the content of each file within the HTML, I have the following:
{% for section in site.sections %}
{{ section.content }}
{% endfor %}
However, the content order is not presented as what I defined in the config file. How do I display the content in the order I defined in the config file?
Manually ordering documents in a collection was introduced in Jekyll 4.0
To use this feature, make sure that you're using Jekyll 4.0
For a site deployed on GitHub Pages, that would mean having to build the site outside GitHub Pages environment and upload the contents of the destination directory (_site).
You can also choose to add the sections to the front matter of the page. This is useful when you are not using Jekyll v4 or you want the user to be able to edit the order in CloudCannon, Netlify CMS, Forestry or another CMS with front matter editor.
sections:
- introduction
- battery-state
- vibe
- references
And the use a layout like this:
{% for s in page.sections %}
{% for section in site.sections %}
{% if s == section.slug %}
...
{% endif %}
{% endfor %}
{% endfor %}
I have a personal website built with jekyll and hosted on Github pages. I am trying to add a sub-site blog within the same domain. For this, I set up a blog.md page and followed the instructions from this website: https://www.garron.me/en/blog/multi-blog-site-jekyll.html. The idea is that if I access http://<mydomain>.com it will go to my personal website, and if I go to http://<mydomain>.com/blog it will go to a different site also set up with jekyll.
My file structure is different than what they suggest in the link above. It is like this:
/personalwebsite
config.yml
index.md
(other personal website pages).md
blog.md
/_site
/_layouts
/_posts
My index.md page is completely customized, and I wrote my own layout for that website. It is a static site and everything in _posts is ignored by it. My blog.md page is also on the root folder and it changes according to _config.yml. I am trying to use Github jekyll themes for it. The theme loads, but instead of showing the posts, it shows the code:
This is what blog.md looks like:
---
layout: blog
title: the blog
permalink: blog
---
{% raw %}
{% for post in site.posts %}
{% if post.categories contains 'blog' %}
<div class="post">
<h3 class="title">{{ post.title }}</h3>
<p class="meta">Date: {{ post.date }}</p>
<div class="entry">
{{ post.content | strip_html | truncatewords: 100 }}
</div>
</div>
{% endif %}
{% endfor %}
{% endraw %}
And this is what a post looks like:
---
layout: post
title: New test
category: blog
---
This is a test post
If I remove the {% raw %} parts in blog.md, the posts show up like this:
I have already checked that my posts are in the right place, the category parameter is filled in, the dates and post filenames are properly formatted. What am I doing wrong? Jekyll does not show any error messages other than a Github metadata warning:
GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data
blog.md is a markdown file.
In markdown a four space indentation represents code or preformatted text.
Kramdown will wrap this code in <pre> tag, resulting on what you actualy see on your site.
If you remove your indentation (or keep it under 4 spaces), your problem is solved.
{% for post in site.posts %}
{% if post.categories contains 'blog' %}
<div class="post">
<h3 class="title">{{ post.title }}</h3>
<p class="meta">Date: {{ post.date }}</p>
<div class="entry">
{{ post.content | strip_html | truncatewords: 100 }}
</div>
</div>
{% endif %}
{% endfor %}
I am using Jekyll to build a web site,
I want to have some folder structure like
root
- _posts
Kinds of MD files
Index.html
- v1.0
- _posts
Kinds of MD files
Index.html
I want to build a web site, the URL like http://host/root/ points to current version document,the URL like http://host/root/v1.0 points to version 1.0 document.
In both index.html, I use code like below,
{% assign sortedCategories = site.categories | sort %}
{% for category in sortedCategories %}
<h1 class="post-title" id="{{ category[1] | replace:' ','-' | replace:'.','' }}">{{ category[1] | join: "/" | upcase }}</h1>
<ul class="post-list">
{% for posts in category %}
{% for post in posts reversed %}
{% if post.title != null%}
<li>
<h2 class="post-title" id="{{ post.id | remove_first:'/'}}">{{ post.title }}</h2>
<article class="post-content">
{{ post.content }}
</article>
</li>
{% endif %}
{% endfor %}
{% endfor %}
</ul>
{% endfor %}
The issues I met is,
As both _post folder has similar posts and category, in the http://host/root/, each post is shown twice.
In URL http://host/root/, it has an additional category which contains all the posts (in both folder _posts and v1.0/posts)
The same issues for URL http://host/root/v1.0
I want to know how I can restrict the site.categories to only search specified folder? Or there is some other suggestions on this?
thanks
posts can not be limited to a particular folder as it is site wide. You can create custom collection. Suppose if you have v1, v2 and root(pointing to v2). You can use the same collection name for v2 and root.
As mentioned by #ganesshkumar, use jekyll collections for this
I have posts in Jekyll sorted by categories that wont display on github pages. The yaml font matter in the post has the categories set to CSS and design but don't display on the category page with the code below:
{% for post in site.categories.CSS %}
{% if post.url %}
<a id="h1a" href="{{ post.url }}">{{ post.title }}</a>
<p id="date">{{ post.author }} • {{ post.date | date: "%b %-d, %Y" }}</p>
<div id="excerpt">{{ post.excerpt }} </div>
<div id="readmore">Read More</div>
{% endif %}
{% endfor %}
It works locally, and the URL path (/css/design/2016/01/10/responsive-web-design-css-viewport.html) shows that the categories are there, but does not display in the link above. Here is my repository, the code above can be found in the css folder of the root directory.
Jekyll 3.x uses categories "as is" : CSS stays CSS.
Jekyll 2.x is down-casing categories : CSS becomes css.
So, on Github pages site.categories.CSS == nil
In order to work locally in Github pages configuration, you can follow install instructions here.
I have a Jekyll blog where the main page is a bunch of links to posts, but where I also want to include a link to a project's gh-pages page and I want the list to stay sorted by date. Right now, I'm just manually inserting it at the top of the page.
<ul class="posts">
<li>
<span class="post-date">Jul 8, 2015</span>
<a class="post-link" href="/QuisCustodiet/">The Most Influential Works, According to TvTropes</a>
</li>
{% for post in site.posts %}
<li>
<span class="post-date">{{ post.date | date: "%b %-d, %Y" }}</span>
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
</li>
{% endfor %}
</ul>
This looks okay, but it will break in a week or two when I make another post. Is there a way to create another "post" and insert it into the list of site.posts in a way that it stays sorted? Is there some other much better way of doing this that I don't know about?
If I understand your problem right, you want to have some "special project posts" in your list of posts that are only links to another specific project site but have a date and therefore can be sorted together with the other posts.
Here is what I came up with:
You create an empty Post in _posts/ with front matter like this:
---
layout: post
title: "Project Example"
customlink: http://www.example.org
date: 2015-07-12 12:50:25
---
The customlink attribute is for the link to your project page. In your html, where you list all your posts, you make an if-statement to check for the attribute and handle it properly. Like this for example:
<ul>
{% for post in site.posts %}
<li>
{% if post.customlink %}
{{ post.title }}
{% else %}
{{ post.title }}
{% endif %}
</li>
{% endfor %}
</ul>
Your project post is treated as your other posts and sorted with them by date, but its link will direct the user to your project page.
Jekyll will still create the html for this post and serve it like all the other posts under a specific path. To prevent this you could add an empty permalink attribute in the posts front matter like permalink: "" and your post would lie under the root of your blog. Jekyll would still create a ".html" file for this post in the _site folder.
You need to create the posts for every external project manually but I do not know a better solution.