Implemented tech section of portfolio projects
Added order for portfolio projects
This commit is contained in:
@@ -58,6 +58,7 @@ Return:
|
||||
```json
|
||||
{
|
||||
id: "blogID",
|
||||
staticPage: false, // static pages don't show up alongside other blog pages.
|
||||
createTime: 0, // creation time in Unix format
|
||||
updateTime: 0, // last update time in Unix format
|
||||
author: "authorID",
|
||||
@@ -170,6 +171,7 @@ Return:
|
||||
[
|
||||
{
|
||||
title: "Darkstorm Server",
|
||||
order: 0,
|
||||
repository: "https://github.com/CalebQ42/darkstorm-server",
|
||||
description: "The backend that runs runs my website and APIs",
|
||||
technologies: [ // May be empty
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
|
||||
type PortfolioProject struct {
|
||||
Title string `json:"_id" bson:"_id"`
|
||||
Order int `json:"order" bson:"order"`
|
||||
Repository string `json:"repository" bson:"repository"`
|
||||
Description string `json:"description" bson:"description"`
|
||||
Technologies []string `json:"technologies" bson:"technologies"`
|
||||
@@ -26,7 +27,7 @@ func (b *BlogApp) Projects(languageFilter string) ([]PortfolioProject, error) {
|
||||
if languageFilter != "" {
|
||||
filter["language.language"] = languageFilter
|
||||
}
|
||||
res, err := b.portfolioCol.Find(context.Background(), filter, options.Find().SetSort(bson.M{"_id": 1}))
|
||||
res, err := b.portfolioCol.Find(context.Background(), filter, options.Find().SetSort(bson.M{"order": 1}))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ const (
|
||||
portfolioTitle = "<h2 class='portfolio-title'>%v</h2>"
|
||||
portfolioLink = "<p class='portfolio-link'><a href='%v'>%v</a>"
|
||||
portfolioLanguage = "<p class='portfolio-language'><b>%v</b>: %v</p>"
|
||||
portfolioTech = "<p class='portfolio-tech'><b>Tech: </b>%v</p>"
|
||||
portfolioDesc = "<p class='portfolio-description'>%v</p>"
|
||||
)
|
||||
|
||||
@@ -42,6 +43,7 @@ func portfolioRequest(w http.ResponseWriter, r *http.Request) {
|
||||
langs[l.Language] = struct{}{}
|
||||
out += fmt.Sprintf(portfolioLanguage, l.Language, l.Dates)
|
||||
}
|
||||
out += fmt.Sprintf(portfolioTech, strings.Join(p.Technologies, ", "))
|
||||
out += fmt.Sprintf(portfolioDesc, p.Description)
|
||||
}
|
||||
langKeys := make([]string, 0, len(langs))
|
||||
|
||||
Reference in New Issue
Block a user