Baseurl not applying to jekyll posts. - jekyll

All pages are working correctly with baseurl except my posts.
What I'm getting
url
https://pizzapgh.github.io/general/2016/08/29/example-post-three/
What I need isntead, "/katietest" before general
https://pizzapgh.github.io/katietest/general/2016/08/29/example-post-three/
In my config I have:
baseurl: /katietest
url "http://pizzapgh.github.io"
Repo
https://github.com/pizzapgh/katietest
Suggestions? I've worked with this before and all I had to do was set the baseurl. I can't seem find out what it is that's not making my post not show.
Thanks.

In _includes/post_list.hmtl you can replace two occurrences of :
<h5><a href="{{ page.url }}"...
by
<h5><a href="{{ site.baseurl }}{{ page.url }}"...
And you can do the same in _includes/post_list.hmtl.

Related

Changing personal site configuration with jekyll

I'm trying to build a site with jekyll. I managed to make math work and upload some files. Now the overall distribution of content is not optimal.
I get a link to "HEAD" that lists a series of updates of Jekyll. I would like to get rid of that.
The main url redirects to some blog entries while you have to click on "About" in order to go to some general information about me. I would like to do it in the opposite way, i.e. having the about section shown in the main url of the page https://rjraya.github.io/ and the blog in some derived url like https://rjraya.github.io/blog
Here are the sources of the page. How can I do this simple changes? I understand that I'm using the Minima template.
Re: HEAD
I think the "HEAD" is coming from the History.markdown file. It is strange that the "HEAD" does not show up in a local jekyll serve development environment. I suspect the code below is picking up History.markdown in jekyll, along with about.md when rendering header.html.
https://github.com/rjraya/rjraya.github.io/blob/ddc6a2f5c5804961da6ac79472b7f77052bef267/_includes/header.html#L20-L27
<div class="trigger">
{%- for path in page_paths -%}
{%- assign my_page = site.pages | where: "path", path | first -%}
{%- if my_page.title -%}
<a class="page-link" href="{{ my_page.url | relative_url }}">{{ my_page.title | escape }}</a>
{%- endif -%}
{%- endfor -%}
</div>
RE: Page Title URL Computational reflections
Change the href from / to /blog in this line
https://github.com/rjraya/rjraya.github.io/blob/ddc6a2f5c5804961da6ac79472b7f77052bef267/_includes/header.html#L7
<a class="site-title" rel="author" href="{{ "/blog" | relative_url }}">{{ site.title | escape }}</a>
RE: About URL
Remove the permalink : /about/ from the about.md page. The about.md will be come the homepage (e.g. /) in the next step.
https://github.com/rjraya/rjraya.github.io/blob/gh-pages/about.md
RE: Show about.md information on homepage rjraya.github.io and show _posts markdown files under rjraya.github.io/blog
Let jekyll use the default behavior of assigning permalinks based on the markdown filename.
Rename index.md to blog.md. This will move the list of _posts files from / to /blog.
Rename about.md to index.md. This will move the content of about.md from /about to /.

Jekyll not building or seeing collection

I can not seem to get Jekyll to recognize that a collection exists!
I have my folder structure like so
_posts
_includes
_layouts
_sass
_site
_portfolio
assets
index.html
_portfolio is the collection
I have it in my _config.yml file as so
colletions:
portfolio:
output: true
And I'm trying to show it in a list here (this snippet is from my default layout which is being used in my index.html)
{% for item in site.portfolio %}
<a href="{{ item.url | relative_url }}" class="portfolio-item-link">
<div class="portfolio-item" style="background: url('{{ site.url }}/assets/img/{{ item.image }}'); background-size: cover; background-position: center;">
<h1 class="portfolio-item-title">{{ item.title }}</h1>
</div>
</a>
{% endfor %}
The problem is Jekyll isn't even adding anything to the collection! If I do {{ site.portfolio | inspect }} it returns nil. I've also tried generating the site on my Ubuntu system (my current system is windows). If anyone has any ideas I'd really appreciate it!
So I misspelled "collections" in my _config.yml file. Don't do that. It works now.

jekyll blog permalink breaks and yields "404 not found"

I have started a small website with a few pages and a couple of blog posts. It is hosted on my organization's server and I ftp'ed all contents of _site/ directory into a subdirectory of the website. Hence the Jekyll site is at http:// myusername.foobar.foo/thiswebsite/ .
In my _config.yml
baseurl: "/thiswebsite"
url: "http:// myusername.foobar.foo"
Now all pages show up correctly. But blog posts don't.
In YAML front matter of each blog post:
permalink: /:title.html
Then I ended up generating links on index.html page to blog posts at http:// myusername.foobar.bar/blog-title.html but the actual blog posts are found at http:// myusername.foobar.bar/thiswebsite/blog-title.html. So if people click on the links found on index.html they will see 404.
On index.html I have:
{% for post in site.posts %}
<h2>{{ post.title }}</h2>
<blockquote>
{{ post.excerpt }}
</blockquote>
{% endfor %}
I would have thought {{ post.url }} would automatically insert correct URL for the posts, but apparently that's not happening. :(
Where did I screw up?
(Jekyll version 3.1.2)
Note: blank space after http:// is intentional as StackExchange thinks I'm posting links and that's apparently not allowed. In my actual markdown and html they are proper URLs.
Link to a collection item (post are collections items) or pages :
eg : {{ post.title }}
or {{ post.title }}
And it's the same for resources links (image, script, css, ...).
eg : <link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
or <script src="{{ site.baseurl }}/js/script.js"></script>

How can I disable the excerpt_link in octopress?

I wrote my posts and added <!-- more --> to where I want to stop the content from showing. After this, octopress shows a "read on" link, I want this not to show. I think this snippet (inside _includes/article.html file) is the key:
{% if excerpted == 'true' %}
<footer>
<a rel="full-article" href="{{ root_url }}{{ post.url }}">{{ site.excerpt_link }}</a>
</footer>
{% endif %}
I tried to delete this snippet and the link still shows. Tried to delete excerpt_link from `_config.ylm' and the html is still generated for the link.
This is the way to do it. Be sure to do it in sources/_includes/article.html and not within .themes/themeName.

Show blog post title in meta information

I'm working on Search Engine Optimization for my Jekyll site, and I am running into an issue where I am unable to set meta information.
...
<meta name="og:title" content="{{ seo_title }}" />
...
<!-- now in my for post-loop: -->
{% for post in site.posts %}
<li class="post-link">
<a class="post-title" href="{{ post.url }}">
<span class="post-date">{{ post.date | date_to_string }}</span>
{{ assign seo_title = post.title }}
{{ post.title }}
</a>
</li>
{% endfor %}
I'm assigning sel_title to the post title, but it's not showing up in my meta information! I just get <meta name="og:title" content="" />
I've also tried adding {{ assign seo_title = page.title }} inside of my post.html post layout to no avail using {{ page.seo_title }} {{ post.seo_title }} and {{ seo_title }}
Now, obviously this really isn't what i want, because logically - after this for loop, it would set it to whatever the last post title was, but i can't even get that to display. Ideally what I would like, is for it to show up for the post.
You can view the page here where I want it to show up.
Where am I going wrong? How can I use my post information to fill my SEO meta information?
Had a look at your github repo. You are using only one basic layout for both index and posts. In your _posts, the YAML Front Matters is getting processed first time (and only once) when you do {% include post.html %}. But then you pass it on to the default layout and you cannot pass the YAML variables from the post through also.
One typical pattern you can adopt is split the default layout and create partial html files in the _includes folder i.e header.html and footer.html. You can then use them to create your default and post layouts. That way you can pass on the relevant YAML Front Matter variables in the post to the header.