Heat a little oil in a non-stick frying pan and fry the lardons over a medium heat until crisp.
Add the onions and garlic and cook in the bacon fat until soft and caramelised. They should be nicely browned and a little sticky. If you need to add more oil, do so.
Add the sugar, thyme, smoked paprika and chilli powder (if using). Cook for a few minutes to allow the sugar (or maple syrup) to melt and caramelise. Then add the cider vinegar and continue to cook until the vinegar has reduced and there's no obvious liquid left (but don't overcook as the ingredients will become dry).
Finally, add the water and ketchup and simmer on a low heat for 5-10 minutes or until the mixture has a jam-like consistency. Check and stir from time to time to make sure it doesn't burn or dry out.
To finish: Add a pinch of salt and freshly ground pepper. Taste and add more salt if necessary.
When cool, transfer to an airtight jar and refrigerate overnight before use. This will allow the flavours to meld and create a wonderful taste. The jam will keep in the fridge for up to 1 week.