How to change favicon in CKAN - themes

I am having trouble with this seemingly simple task..
Can someone help please?
I have uploaded .ico file to /usr/lib/ckan/default/src/custom_theme/ckanext/custom_theme/public
Changed value in setting file (development.ini)
Tried making base.html for the custom theme, with
{% ckan_extends %}
{% block links -%}
<link rel="shortcut icon" href="http://site.address/favicon.ico" />
{% endblock -%}
For file path, I have tried both relative and literal.
I can access the icon file if I type in address of it in web browser.

This is what works for me*:
Define favicon filename in your .ini eg. ckan.favicon = favicon.ico
Upload file to ../ckan/default/src/ckanext-[your_theme]/ckanext/[your_theme]/public
Reload apache
Clear Browser cache
Reload site in Browser
This assumes CKAN >2.5 and following instruction on creating a custom theme
No need to change the base.html file in custom theme.

In CKAN 2.9.0 replace /usr/lib/ckan/default/src/ckan/ckan/public/base/images/ckan.ico with your ICO file.
Assuming you have:
ckan.favicon = /base/images/ckan.ico in your ckan.ini
Refresh your browser.

Related

Not able to load logo on the web

Hope you can clarify this issue:
I am trying to ad a favicon to my website in the head of my html layout, the link i am using is :
href="{{ asset('assets/public/images/favicon-32x32.png') }}"
I have my file in the following route:
backend/public/images/icon.png
the icon is not displaying on the web anyway, any idea about what can be the issue here?
thanks
as in laravel documentation
The asset function generates a URL for an asset using the current
scheme of the request (HTTP or HTTPS):
$url = asset('img/photo.jpg');
You can configure the asset URL host by setting the ASSET_URL variable
in your .env file. This can be useful if you host your assets on an
external service like Amazon S3:
// ASSET_URL=http://example.com/assets
$url = asset('img/photo.jpg'); // http://example.com/assets/img/photo.jpg
so if you use default ASSET_URL value in .env file and your favicon file in file structure like :
project_Folder/public/images/favicon.ico
so you need to make your link like
{{-- favicon --}}
<link rel="shortcut icon" href="{{ asset('images/favicon-32x32.png') }}">

Jekyll Collection of _posts Not Rendering on _site

can someone help me?
I have a Jekyll site on netlify (http://127.0.0.1:4000/) that is working great.
I followed this tutorial to create a Jekyll admin path with CMS (http://127.0.0.1:4000/admin) to administrate the posts I want to write.
Basically, I created a new admin folder with two files, index.html and config.yml. My new file config.yml is like so...
It is working properly, I can create and update the posts on the _posts folder as expected.
Wherever, I'm trying to create a blog on a subpath of that site, like http://127.0.0.1:4000/blog for loop through the posts on _posts on such path, but I doing something wrong and can't figure out what is it.
The last thing I tried was to create a collection for the posts on the main file _config.yml like so...
I tried two permalinks, add/remove the folder and add layout, but I think I'm forgetting something.
To help you guys understand the whole project, my index.html has
---
layout: default
---
and the layout default is on the folder _layouts and contains many imports that are on the folder _includes.
Finally, I tied to loop through the collection of _posts on index.html adding code like bellow on the file posts_list.html that was imported as you can see above...
<h1>Latest Posts</h1>
<ul>
{% for p in site.posts %}
<li>
{{ p.title }}
<!-- {{ p.excerpt }} -->
</li>
{% endfor %}
</ul>
and also creating a new html file called posts.html on the same folder of index.html with the same code above, but in both cases the posts are not rendering.
Finally, this is my whole project...
If you want more info about what I'm doing, just ask,
Thanks for helping me...
[UPDATE 1]
My posts are .md files, here is an example...
As you can see I also created some extra layouts, one for compiling all posts blog and another for show the post itself post.
Change the extension to .md (on your posts and index file) and add frontmatter, referencing your template. Your posts.md and index.md files should look like this:
---
layout: default
---
Check for errors... if there are none it should output just fine.
UPDATE
Thank you for sharing your code at https://github.com/nielsenrechia/nr.github.io.
I see that you created random comments in your config file. They mess things up. Clean up your config file and use the right indents and new lines. Check out the Jekyll documentation at https://jekyllrb.com/ for help. Further you seem to reference your posts by calling site._posts. That should be site.posts. Finally, you do not need to specify the posts collection in the config file. It is assumed that it exists and uses the _posts folder.
Here is an image of the working posts section:

flask blueprint for custom static folder not working in templates using url_for

I am trying to use a blueprint to serve some of my js and css files from a folder than /static. I want these files to be available from the root. I have registered the following blueprint with the app:
custom = Blueprint('/', __name__, static_folder='custom', static_url_path='/custom')
app.register_blueprint(custom)
I can find the desired files in the expected place, ie. /custom/custom.css by putting this url directly into the browser, however, I am not able to access them in templates using url_for like this:
<link href="{{ url_for('custom', filename='style.css') }}" rel="stylesheet">
I get: BuildError: ('custom', {'filename': 'style.css'}, None)
I have tried any number of combinations ie.:
custom = Blueprint('custom', __name__, static_folder='custom', static_url_path='/custom')
with
<link href="{{ url_for('custom.custom', filename='style.css') }}" rel="stylesheet">
etc but nothing is working for me.
You need to use the blueprint's static endpoint.
url_for('custom.static', filename='custom.css')

How to link to a page with page.url without the html extension in Jekyll?

I'm building a website in Jekyll. To remove html extension in posts I added the following to _config.yml
permalink: /kb/:title
To remove html extension from pages, I created folders for each page, and placed an index.html file in each page folder.
Now the posts and pages work without html extension, but when I link to a page with page.url it returns the whole link (/kb/index.html) instead of just /kb.
What variable can I use to link to a page without html extension?
The value returned by {{ page.url }} reflects what the permalink for the page is.
To get the urls to not include the "index.html" part you will need to add a permalink setting to the front matter for each of these pages. This actually removes the need of having all the files named "index.html" and in separate folders.
So your front matter would contain something like:
---
permalink: /scratchpad/level/relative/
---
Note the trailing slash, if you omit this then Jekyll would create a file called "relative" instead of a directory containing an index.html file.

Generate sitemap in Jekyll without plugin

I just shifted my entire blog from WordPress to Jekyll. There are still some pieces that need fixing here and there, but I am facing this problem at the moment. I am unable to generate sitemaps in Jekyll. I saw that there are a couple of plugins which can do the work for me.
Information on the site:
Site hosted via Github pages
Entire site handcoded - not using JB or Octopress
It would be great if you I could get some pointers towards how to do the required.
Note: This question is not the same as it's predecessors. I am not looking for options which use _site.
As explained by John Day in this article, you can create a sitemap.xml file in the site's root with this content:
---
layout: nil
title : "Sitemap"
sitemap_exclude: y
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for post in site.posts %}
<url>
<loc>{{site.production_url}}{{ post.url | remove: 'index.html' }}</loc>
</url>
{% endfor %}
{% for page in site.pages %}
{% if page.sitemap_exclude != 'y' %}
<url>
<loc>{{site.production_url}}{{ page.url | remove: 'index.html' }}</loc>
</url>
{% endif %}
{% endfor %}
</urlset>
In _config.yml, define a variable named production_url with the site's full base URL (e.g. http://example.com).
If you want to exclude any links from the sitemap, include sitemap_exclude: y in the front matter of the page or post.
For a more advanced example refer to this article: Building a Better Sitemap.xml with Jekyll.
You could create a new file in your site root called 'sitemap.xml', and within that page use liquid tags to iterate over all pages and posts extracting the necessary data. Seems like that would do the job pretty easily, assuming that you just want to generate a page which lists every page on the site in an xml format that conforms to the appropriate standard.
Just came across this because my site is hosted on github-pages.
It seems github pages now supports this.
Just had to add to _config.yml:
gems:
- jekyll-sitemap
(You can optionally add to your Gemfile, but mine was already included via dependency)
(fun fact: jekyll-redirect-from is also supported by github pages)
You can not automagically generate a full sitemap in jekyll without using plugins.
What you could do is make your own ruby (or else) script that generates a sitemap as JSON data and then insert it in your config.yml. From there you could access that data from jekyll and display it.
But there is no built-in way to do that just with jekyll.

Resources