Skip to content

[Bug]: Recently-viewed always records 'General' - project.html never sets data-project-interest #1859

Description

@ionfwsrijan

Summary

Every recently-viewed entry is recorded with the interest "General" because project.html never emits the data-project-interest attribute that script.js looks for. The "Recently Viewed" panel (recently-viewed.js) then displays a meaningless "General" chip on every card instead of the project's actual interest (e.g., "Web", "Data", "Cybersecurity").

Evidence

src/static/script.js:1161-1166 (project page view tracking):

if (typeof RecentlyViewed !== "undefined") {
  var projectInterest = document.querySelector("[data-project-interest]");
  var interest = projectInterest ? projectInterest.getAttribute("data-project-interest") : "General";
  RecentlyViewed.trackView({
    id: ...,
    title: ...,
    interest: interest
  });
}
  • A repo-wide search for data-project-interest returns zero matches in src/templates/project.html (and anywhere else), so projectInterest is always null and interest is always "General".
  • src/static/recently-viewed.js:107-112 stores that value (interest: project.interest || "General") and renders it at line 182 (interest.textContent = project.interest).

Impact

  • The recently-viewed panel shows a useless constant "General" label instead of the actual interest category, degrading the feature's purpose (quickly recognizing what kind of projects you were looking at).
  • The project detail page already knows the interest (Project.interest is rendered elsewhere on the page), so the data is available — it's just never wired to this attribute.

Suggested Fix

Add data-project-interest="{{ project.interest }}" to the appropriate element in src/templates/project.html (e.g., the <body> or a wrapper section), so the view tracker captures the real interest. Update the tracker to fall back to the project's own metadata rather than a hardcoded string.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions