Where to put Custom Timeline Template?

Hi, I’m trying to use the additional_timeline_content hook in a custom app.


additional_timeline_content: {
    # show in each document's timeline
    "*": ["app.timeline.all_timeline"]
    # only show in ToDo's timeline
    "ToDo": ["app.timeline.todo_timeline"]

def todo_timeline(doctype, docname):
    # this method should return a list of dicts
    return [
             # this will be used to sort the content in the timeline
            "creation": "22-05-2020 18:00:00",
            # this JS template will be rendered in the timeline
            "template": "custom_timeline_template",
            # this data will be passed to the template.
            "template_data": {"key": "value"},
  1. I enabled the timeline hook and pointed it to a timeline.py file in my app

  2. In timeline.py, I included the function all_timeline(doctype, docname) which has a JS template “custom_timeline_template”, according to the Frappe documentation

  3. Questions is, where do I put the file custom_timeline_template.js in my app?

Frappe throws a template not found error when I put it in:
/public/js, or
/public, or
/templates, or
/templates/pages, or
next to timeline.py

Thanks in advance!

1 Like

I think template should be in frappe.tempaltes
to load template here. you need to write a .html file. and load this file in build js.
if you using version 13 or older then user public/build.json file to build a js file and include this file form hooks.py (include_app_js).
if you use version 14 then use public/js/yourapp.bundle.js. import .html file here and include by hooks.py

Thank you so much for your reply!

Looking at the source code of timeline, it doesn’t look like a separate .html file is needed besides the standard .html for desk.

I did add the hooks for app_included_js and put the template.js file in public/js folder, and ran build.json. But it still doesn’t work.

Any Update on it?