Moved thumbnail image tag to Block with conditional lazy load. #95
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: HPR/hpr_generator#95
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "refs/pull/95/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add lazy loading of host avatars to the correspondents page
@gordons I created a work in progress pull request to make code review easier
Thanks for your help, I do hope you have time and inclination to keep contributing.
In general the template file naming scheme is (I will admit sometimes I get lazy and don't follow my own rules):
Your lazy image loading code is good and think it should be moved to a lazy_load macro and placed in shared-avatar.tpl.html file. We can use it in the future for lazy loading other images.
The macro get_avatar should be renamed get_avatar_src, and move your host_thumb macro host-thumbnail.tpl.htm to the shared-avatar.tpl.html and update it to use the new lazy_load macro.
Update pages to call just the get_avatar macro.
I've renamed get_avatar to get_avatar_src in all the places.
Moved host_thumb into
shared-avatar.tpl.html
and added a parameter for when after the host_cnt lazy loading should be added.I'm a bit confused about the other things you wrote.
Separately, I have a way of adding lazy loading to the images in each show notes, but I need to make it work in template land first. This will be in a different issue and performed in a different way to these host avatars, since it will be processing HTML in
notes
variable.I don't think a generic lazy_load macro is terribly practical for this site without a lot of parameters for attributes.
I will try my best to follow your naming conventions etc. The hard tabs threw me for a second. I'm not partically great at naming variables.
@gordons I was going to try and explain my "vision" for the name changes and combining macro's, but just updating the code was quicker and clearer :)
Let me know if you are ok with the changes, or have any suggestions or corrections. If none, feel free to remove the WIP: from the title of this PR and merge it with main.
Thanks!
Not sure
content-episode.tpl.html
should have show_avatar instead of get_avatar because I'm not sure it had a link before, but it might be better that it does. Ditto withcontent-twat_episode.tpl.html
I guess.Other than that it all looks good and makes sence.
I double checked the HPR website and there are links on the main website. I did also see closing anchor tags without the opening tag, which is what made me add it back. I must have deleted accidentally along the way. Going to merge into main.