feat: Cmd+K search — rich keywords, real logos, category icons
- Projects searchable by technologies, "open source", category (cli/app/web) - Experience searchable by technologies, shows company logo + position - Courses show institution logos - Project logos used as icons instead of generic mdi:web - Category-specific fallback icons (console, apple, puzzle, etc.)
This commit is contained in:
@@ -15,6 +15,8 @@ type CmdKAction struct {
|
||||
Title string `json:"title"`
|
||||
Section string `json:"section"`
|
||||
Keywords string `json:"keywords"`
|
||||
Category string `json:"category,omitempty"` // cli, app, web, plugin, sdk, contrib
|
||||
Icon string `json:"icon,omitempty"` // Project logo filename
|
||||
}
|
||||
|
||||
// CmdKResponse represents the response for the CMD+K API endpoint
|
||||
@@ -48,43 +50,76 @@ func (h *CVHandler) CmdKData(w http.ResponseWriter, r *http.Request) {
|
||||
// Map experiences
|
||||
for _, exp := range cv.Experience {
|
||||
if exp.CompanyID == "" {
|
||||
continue // Skip entries without ID
|
||||
continue
|
||||
}
|
||||
keywords := exp.Company + " " + exp.Position
|
||||
for _, tech := range exp.Technologies {
|
||||
keywords += " " + tech
|
||||
}
|
||||
keywords += " work job career"
|
||||
icon := ""
|
||||
if exp.CompanyLogo != "" {
|
||||
icon = exp.CompanyLogo
|
||||
}
|
||||
response.Experiences = append(response.Experiences, CmdKAction{
|
||||
ID: "exp-" + exp.CompanyID,
|
||||
Title: exp.Company,
|
||||
Title: exp.Company + " — " + exp.Position,
|
||||
Section: "Experience",
|
||||
Keywords: exp.Company + " " + exp.Position,
|
||||
Keywords: keywords,
|
||||
Icon: icon,
|
||||
})
|
||||
}
|
||||
|
||||
// Map projects
|
||||
for _, proj := range cv.Projects {
|
||||
if proj.ProjectID == "" {
|
||||
continue // Skip entries without ID
|
||||
continue
|
||||
}
|
||||
title := proj.ProjectName
|
||||
if title == "" {
|
||||
title = proj.Title
|
||||
}
|
||||
keywords := title + " " + proj.ShortDescription
|
||||
for _, tech := range proj.Technologies {
|
||||
keywords += " " + tech
|
||||
}
|
||||
if proj.OpenSource {
|
||||
keywords += " open source open-source oss github"
|
||||
}
|
||||
if proj.Category != "" {
|
||||
keywords += " " + proj.Category
|
||||
}
|
||||
icon := ""
|
||||
if proj.ProjectLogo != "" {
|
||||
icon = proj.ProjectLogo
|
||||
}
|
||||
response.Projects = append(response.Projects, CmdKAction{
|
||||
ID: "proj-" + proj.ProjectID,
|
||||
Title: title,
|
||||
Section: "Projects",
|
||||
Keywords: title + " " + proj.ShortDescription,
|
||||
Keywords: keywords,
|
||||
Category: proj.Category,
|
||||
Icon: icon,
|
||||
})
|
||||
}
|
||||
|
||||
// Map courses
|
||||
for _, course := range cv.Courses {
|
||||
if course.CourseID == "" {
|
||||
continue // Skip entries without ID
|
||||
continue
|
||||
}
|
||||
keywords := course.Title + " " + course.Institution
|
||||
keywords += " course training certification"
|
||||
icon := ""
|
||||
if course.CourseLogo != "" {
|
||||
icon = course.CourseLogo
|
||||
}
|
||||
response.Courses = append(response.Courses, CmdKAction{
|
||||
ID: "course-" + course.CourseID,
|
||||
Title: course.Title,
|
||||
Section: "Courses",
|
||||
Keywords: course.Title + " " + course.Institution,
|
||||
Keywords: keywords,
|
||||
Icon: icon,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user