Get the Name and Relative Path of the File to be Created in Cheetah

31 views
Skip to first unread message

Karen K

unread,
May 13, 2021, 12:51:02 PM5/13/21
to weewx-development
To create the "canonical" tag in the HTML header, the real file name of the file to be created is needed. The tag looks like that

<link rel="canonical" href="https://www.mywebsite.com/index.html" />

The first part https://www.mywebsite.com is provided by $station.station_url.

But the second part?

It comes from skin.conf from the [CheetahGenerator] section from the template entry. The target file name is determined in cheetahgenerator.py in line 276ff., but it is not included in the search list there. May be there is some other way to get that information.

The problem here arises if I use a common include file for all pages to define the HTML header. I could set it by #set before the #include line, but that is double content, as WeeWX knows about the file name, and it is prone to typos.

Is there a simple way?


Reply all
Reply to author
Forward
0 new messages