Custom liquid functions in jekyll projects - jekyll

I was wonder how could I include my own Liquid filters and functions to a Jekyll project
Jekyll provide its set of liquid filters and functions, but I would like to increase this set with my own. How could I do this?
And, also, would it work in Github Pages?

Related

Jinja2: combine/precompile templates into one

I have an application that uses a hierarchy of Jinja2 templates to build reports. At the same time, I have a requirement to distribute my application as executable files built with PyInstaller. When I try to discover my templates using the normal approach with loaders and environment, Jinja cannot find my templates because of the way PyInstaller works. However, I can load my templates directly, but they cannot be rendered because they need to be loaded "normally" to get at the "super" templates.
What I was thinking is try to turn all those hierarchies of templates into flat templates at build time and then incorporating those into my PyInstaller-built executables, but I couldn't figure out how.
Is it possible? Or is there a better way of doing it? (And yes, we will drop the PyInstaller thing in the future)

Imported Templates not working on MediaWiki

I am quite new to Mediawiki and am trying to get templates work.
I managed to get a simple one working but the templates are shown in a weird way but no error is provided.
I looked at your template:
http://wordpress-251650-782015.cloudwaysapps.com/index.php?title=Template:Cita_conferenza
And it invokes a LUA module:
http://wordpress-251650-782015.cloudwaysapps.com/wiki/Modulo:Citazione
You can read more information about using this module on
https://it.wikipedia.org/wiki/Modulo:Citazione
#Revious
A bit late, but you may still be interested...
If you want to copy a template from Wikipedia, but it is using lua modules, you can look in the history tab to find pre-lua versions that use only wikicode (lua has been implemented in 2013 in Wikipedia, but some templates have been given modules later).
Here, it seems to be this version
Be careful, however, if the template you are copying uses subtemplates (this does not seem to be the case here).
If this is the case, you should either make copies of the templates with the same name and code, or add their code to the main template, paying attention to the parameter names which will need to be adapted.
Good luck.

How do I debug python sphinx themes?

I want to edit a Sphinx theme and can't understand what variables are present in the document. The official documentation laks any kind of information.
How do I see what variables are present in the template?
I think this documentation page will help you - it describes what blocks, configuration variables, helper functions and global variables are available in the template.
And, by default sphinx uses jinja2 templating language - so you can print out the whole template context, like it was suggested in this thread (not sure it'll work in your case).
Hope that helps.

Jekyll recompiles every page every time

When I run jekyll to generate my site, it regenerates every page. How do I tell it to generate only pages which are new or have changed?
Alternatly, what am I doing to make Jekyll think it need to recreate every page?
Jekyll automatically regenerates the entire site each time it runs -- that's just how it works. However, I believe it will only regenerate changed files if you pass the flag:
--watch
as in:
jekyll build --watch
Note: Instead of jekyll build --watch, older versions of jekyll use jekyll --auto.
As mipadi said, Jekyll regenerates the entire site when compiling it. However, the --auto flag makes it compile the whole thing, always.
It does this because, as elithrar said, each post/page can depend on one another and, as it's all decided during compile time, it can't be generated on the fly like it would in WordPress or Tumblr. So, to avoid broken links, everything is regenerated.
This can be problematic on the long run. For example, very big sites (>1000 posts) report extremely long compiling times with LSI enabled, which was addressed with some configuration options lately. And there are other problems, i.e. if you're dealing with CSS/JS (or LESS, SASS, CoffeeScript, be my guest), why would you recreate the whole thing?
This is a recurring discussion on Jekyll's issue list, so if you guys can think of a good solution, please post it there.
But, sincerely? If your site is small enough, just let it regenerate everything. It's much simpler this way.
For speeding up local development you can use --limit_posts NUM to limit the number of posts to parse. This can lead to significant time saving for sites with a lot of posts.
See
https://jekyllrb.com/docs/configuration/#build-command-options

Using Django to create static, CD held website

I've been tasked at work to create a 'website' on a CD for a client. I've made a start where basically everything is hardcoded pure html, and god how easily you forget how amazing templates are, so much freakin' boilerplate. So I would prefer to somehow create a set of linked html pages using a template system.
Is there some method of easily producing a set of linked html files (suitable for CD, i.e. no webserver) using something like Django? The project is doable by hand, but there's a lot of overhead.
Would love to hear alternative ideas as well, not set on Django, just what I'm kind of familiar with.
Note: Can't include any software, can't use anything from the internet. Flat html, on the cd.
You might be interested in a static-site generator like Hyde (Python) or Jekyll (Ruby). Essentially lets you create pages in Markdown/Textile/whatever with templates, and then generate static HTML files with a simple shell command. You can deploy it however you want, since it's just files.
I've used Jekyll myself because I heard about it first (despite being a Python guy primarily), but Hyde seems a bit more competent (CSS processors, for example). Jekyll is more widely used, I think.
(Using Django would mean that you'd have to run a Django installation on some server just to create the content and then generate "linked html files"...)
Here is another approach: http://lethain.com/intricate-static-websites-with-django-templates/