Hello and thank you in advance for any help/suggestions regarding my issue,
Background information: I have been working with the Jekyll static-site generator, The theme I am using has one blog feature being posts this is in use already.
The existing loop shows all the markdown files within its directory:
{% assign posts = paginator.posts | where: "lang", page.lang %}{% for post in posts %}
I am currently using Jekyll 3.8.5.
Goal: Create a second blog being notes. However, this blog should be able to house 3 subdirectories with the option to filter between the 3 subcategories. The top-level directory is ‘release notes’ this page should show all subdirectories.
Each subdirectory should only show their specific files i.e. iOS only shows the specific release notes filtered by category ‘iOS’ in each markdown file.
I want to create a second blog called ‘release notes’ housing 3 different sub-collections (categories), being Android, iOS, and Windows; each subdirectory of release notes will host several Markdown files which will all be of the same type (same tag or category)
Structure:
_releasenotes
- ios
- android
- windows
I have tried to implement the function using the approach from this thread: [https://stackoverflow.com/a/38870168/1914835][1] without complete success.
Approach: Creating an individual index.html for _releasenotes this will show all markdown files within that directory using this loop:
{% assign notes = site.releasenotes| sort:'title' %}
{% for note in notes %}
{% if page.url != note.url and include.category == nil or note.url contains include.category %}
<a href={{ note.url | prepend: site.baseurl }}>{{note.title}}</a>
{% endif %}
{% endfor %}
This code is then injected into the index.html within the release notes directory which simply looks like this:
---
title: release notes
---
{% include list-releasenotes.html %}
Outcome: Once the site builds it replaces the created index.html with the original site index.html which defeats the purpose.
Each sub-collection has its own ‘index.html’ which for-loops all the MD files within. Jekyll however does not use the provided index pages for each collection but rather generates its own index.html being the (wrong) ‘landing page’.
Jekyll generates releasenotes/index/index.html :(
Giving me:
public
- releasenotes
- index.html (the original site index.html)
/ios
/android
/windows
/index/index.html (mine that includes another html)
Instead of:
public
- releasenotes
- index.html (Mine which includes another html)
/ios
/android
/windows
How can I configure Jekyll that it doesn’t convert my index.html (in _releasenotes) to a subdirectory but should use my created index.html as the entry page for release notes?
Keeping in mind that I can see all release notes within the release notes folder and within the subfolder, I should be able to filter between iOS, Android and Windows.
Here are the collection configurations:
collections:
releasenotes:
output: true
android:
output: true
ios:
output: true
portal:
output: true
The _releasenotes/index.html collection item file is output to releasenotes/index/index.html because of the default permalink setting.
You can overwrite it by setting this in the front matter for that file:
permalink: /releasenotes/index.html
Related
I'm setting up a Hugo website, theme academic, in R via hugodown. In the "about" section is a column named "interests" which I want to rename into "work".
What I have done so far:
The content/authors/admin/_index.md file contains following code:
interests: # <- I want to rename this into 'work'
- Artificial Intelligence
- Computational Linguistics
- Information Retrieval
If only this file is renamed then the whole column "interests" won't show.
There is another file layouts/partial/widgets/about.html which contains the following code:
{{ with $person.interests }}
<div class="col-md-5">
<h3>{{ i18n "interests" | markdownify }}</h3>
<ul class="ul-interests">
{{ range . }}
<li>{{ . | markdownify | emojify }}</li>
{{ end }}
</ul>
</div>
{{ end }}
Additional to the above change, naming with $person.interests into with $person.work will show the column again, but it is still called "interests". When additionally changing the i18n "interests" in the <h3> tag into i18n "work" the heading "interests" is removed and only the content of the column is displayed without a heading.
It seems like the new column name "work" has to be registered somewhere else, before it is properly display.
Any help appreciated.
After fiddling around I found the answer to my question. As I expected there is a file in which all ids and their translation are registred. It depends on the choosen language. If the chosen language is English en then it is enough to go to the folder: themes/academic/i18n/ and open the file en.yaml. Here we find:
# About widget
- id: interests
translation: Interests
This can be changed to:
- id: interests
translation: Work
Now the website will properly display "Work" instead of "Interests" on the About widget page.
I'm new to D8. I want to customise the theme of a view. I have already created a block view and assigned into the sidebar of bartik's theme (default provided). See the below screen shot.
Now, I've made the twig debug as true and saw the theming guide for the view files:
<!-- FILE NAME SUGGESTIONS:
* block--views-block--articles-block-1.html.twig
* block--views-block--articles-block-1.html.twig
* block--views-block.html.twig
* block--views.html.twig
x block.html.twig
-->
Now, I have created a file named "block--views-block--articles-block-1.html.twig" within the path: "/themes/bartik/templates/views/" and wrote something like:
Hello
{% for row in rows %}
test
{% endfor %}
After clearing cache, I see there is no change in the view theme and it renders as default.
What did I missed?
You are creating block template that contains block title and content, not a views template.
The view template name should start by "views--".
#niladri, You have chosen format to unformmated.I will suggest to create template in views directory in your theme. Views-view-unformatted--[view machine name]--[view display name].html.twig
Clear cache after this via drush or Drupal
admin/config/development/performance.
I recently set up a blog with Jekyll / GitHub Pages and it automatically provides an RSS feed.
Embedding images in the blog itself works perfectly fine, using:
{{ site.baseurl }}/...
but in the RSS feed, they are not displayed.
I also noticed that this website: https://validator.w3.org/feed/ throws quite some errors, always saying that description should not contain relative URL references: /blog/assets/images/IMG_8196.jpg.
It would be great if you had an idea on how to solve this, because absolute URLs aren't too great especially when it comes to testing on own server / localhost.
Thank you in advance!
In _config.yml, set url and baseurl, if needed.
Any link or resource in your feed.xml must be pointing to an absolute url. This file is consumed my tools that only knows where to find things with absolute urls.
{{ site.url }}{{ site.baseurl }}/myPath/myFile.html
This can also be done with the new absolute_url filter
{{ "myPath/myFile.html" | absolute_url }}
And this is true for links, images, css, js, and so on.
I have this static page built with Jekyll and host with GitHub Pages (repo), and I wanted to track it with Google Analytics.
I was following this tutorial.
But I've reached the step where it says:
Finally, open _includes/head.html and add the following code just before the end tag.
And actually my theme has no _include/head.html file!
So my question is, if I create a file called _include/head.html should it be automatically included in every page built by Jekyll? (I tried creating such a file and adding a placeholder image to see if that worked but it didn't)
The code that follows that quote should be included in every html page built by Jekyll, right? Like, that is what I want for it to work, no? So if I put it in footer.html instead it should work?
If you create that file, as the tutorial suggests, then you can use it everywhere, (in your layout for example) so every time you include it, it gets rendered.
Create the file _includes/head.html with the analytics content.
Then in your layout include it where you want it to appear like:
{% include head.html %}
Then you can place all your code that goes in your head there, so you have a cleaner layout
side note
I prefer to have the analytics code following Google recommendation immediately after the opening <body> tag. So my default layout looks like:
<!DOCTYPE html>
<html>
{% include head.html %}
<body>
{% include ganalytics.html %}
{% include header.html %}
{{ content }}
{% include footer.html %}
</body>
</html>
and _includes/ganalytics.html just contain the analytics code.
Simple add analytics marker in _layouts/default.html head tag. No need to add a head include.
there.
Here's my config.yaml:
# Permalinks
permalink: pretty
relative_permalinks: true
# Setup
title: Tom Critchlow Title
tagline: My Github Site
url: http://tomcritchlow.com
paginate: 1
baseurl: /
author:
name: Tom Critchlow
url: https://twitter.com/tomcritchlow
email: tjcritchlow#gmail.com
collections:
- poetry:
output: true
And here's my folder structure:
-config.yaml
-index.html
-archive.md
_layouts
_poetry
_posts
Yet on my archive page when I do this:
{% for poem in site.poetry %}
hello world
{% endfor %}
Nothing happens... I'm also struggling to render anything in my poetry collection.
You can see the github repo here:
https://github.com/tomcritchlow/tomcritchlow.github.io
What am I doing wrong? How do you get collections working on Github pages? I'm totally new to github. Thanks.
You had config.yaml instead of _config.yaml
Looking at you github repository gave me some ideas about your problems.
First, answering to your question, your config.yaml file MUST be named _config.yml if you want Jekyll to take it into account.
But, there is a lot of other issues all over you site (empty _layouts/default.html, no _layouts/page.html, _layouts/blog.html as no front matter, baseurl/ set to / instead of "",...).
I really think it's better to work on an new clean version and copy you content to it.
gem update
make a new working folder eg: mkdir newjekyll
go to it
jekyll new .
copy your content to your new jekyll including your collection
jekyll serve
all will be ok on 127.0.0.1:4000/