From 3a81824019cc39303c31ea1338afe003a9f498db Mon Sep 17 00:00:00 2001 From: aziis98 Date: Thu, 25 Jun 2020 21:20:35 +0200 Subject: [PATCH] Basic site --- README.md | 20 +- assets/style.css | 64 ++++++- auth.go | 74 +++---- blog/archetypes/default.md | 14 +- blog/config.toml | 18 +- .../post/come-usare-il-servizio-git.md | 11 ++ blog/content/post/hugoisforlovers.md | 4 - blog/content/post/nuovo-sito-di-poisson.md | 11 ++ .../2014/04/02/goisforlovers/index.html | 48 ++--- .../2014/04/02/hugoisforlovers/index.html | 46 +++-- .../2014/04/02/migrate-from-jekyll/index.html | 38 ++-- .../09/28/creating-a-new-theme/index.html | 38 ++-- .../25/come-usare-il-servizio-git/index.html | 180 ++++++++++++++++++ .../06/25/nuovo-sito-di-poisson/index.html | 180 ++++++++++++++++++ blog/public/404.html | 40 ++-- blog/public/categories/guide/index.html | 148 ++++++++++++++ blog/public/categories/guide/index.xml | 24 +++ .../public/categories/guide/page/1/index.html | 1 + blog/public/categories/index.html | 155 +++++++++++++++ blog/public/categories/index.xml | 33 ++++ blog/public/categories/page/1/index.html | 1 + blog/public/categories/progetti/index.html | 148 ++++++++++++++ blog/public/categories/progetti/index.xml | 24 +++ .../categories/progetti/page/1/index.html | 1 + blog/public/index.html | 84 +++++--- blog/public/index.xml | 53 ++++-- blog/public/page/1/index.html | 2 +- blog/public/page/about/index.html | 32 ++-- blog/public/page/contact/index.html | 32 ++-- blog/public/page/index.html | 46 +++-- blog/public/page/index.xml | 13 +- blog/public/page/page/1/index.html | 2 +- blog/public/post/index.html | 84 +++++--- blog/public/post/index.xml | 41 ++-- blog/public/post/page/1/index.html | 2 +- blog/public/project/index.html | 44 +++-- blog/public/project/index.xml | 9 +- .../project/my-awesome-project/index.html | 38 ++-- blog/public/project/page/1/index.html | 2 +- blog/public/sitemap.xml | 69 ++++--- blog/public/tags/development/index.html | 44 +++-- blog/public/tags/development/index.xml | 13 +- .../public/tags/development/page/1/index.html | 2 +- blog/public/tags/go/index.html | 44 +++-- blog/public/tags/go/index.xml | 13 +- blog/public/tags/go/page/1/index.html | 2 +- blog/public/tags/golang/index.html | 44 +++-- blog/public/tags/golang/index.xml | 13 +- blog/public/tags/golang/page/1/index.html | 2 +- blog/public/tags/hugo/index.html | 42 ++-- blog/public/tags/hugo/index.xml | 9 +- blog/public/tags/hugo/page/1/index.html | 2 +- blog/public/tags/index.html | 52 ++--- blog/public/tags/index.xml | 29 ++- blog/public/tags/page/1/index.html | 2 +- blog/public/tags/templates/index.html | 42 ++-- blog/public/tags/templates/index.xml | 9 +- blog/public/tags/templates/page/1/index.html | 2 +- blog/public/tags/themes/index.html | 42 ++-- blog/public/tags/themes/index.xml | 9 +- blog/public/tags/themes/page/1/index.html | 2 +- main.go | 16 +- views/base.html | 13 +- views/home.html | 51 ++++- 64 files changed, 1794 insertions(+), 579 deletions(-) create mode 100644 blog/content/post/come-usare-il-servizio-git.md create mode 100644 blog/content/post/nuovo-sito-di-poisson.md create mode 100644 blog/public/2020/06/25/come-usare-il-servizio-git/index.html create mode 100644 blog/public/2020/06/25/nuovo-sito-di-poisson/index.html create mode 100644 blog/public/categories/guide/index.html create mode 100644 blog/public/categories/guide/index.xml create mode 100644 blog/public/categories/guide/page/1/index.html create mode 100644 blog/public/categories/index.html create mode 100644 blog/public/categories/index.xml create mode 100644 blog/public/categories/page/1/index.html create mode 100644 blog/public/categories/progetti/index.html create mode 100644 blog/public/categories/progetti/index.xml create mode 100644 blog/public/categories/progetti/page/1/index.html diff --git a/README.md b/README.md index 713d4b8..1c3d88d 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,28 @@ Servizio del nuovo sito del PHC -### Technologies +## Technologies - [Gin Web Framework](https://gin-gonic.com/) — https://github.com/gin-gonic/gin Sembra un framework abbastanza usato ed ha molte stelle. +- [Hugo](https://gohugo.io) — Generatore statico di blog scritto in Go. + + Tutta la parte di contenuti: blog, notizie, guide, etc. Verrà gestita da Hugo e servita sotto l'url `/blog`. + ## Development -Esegui `go run main.go` per farlo girare su `localhost:8000` e vedere le modifiche in diretta, amico. \ No newline at end of file +Esegui `go run main.go` per farlo girare su `localhost:8000` e vedere le modifiche in diretta, amico. + +## Design (?) + +### Fonts + +- Share 700: per le intestazioni +- Ubuntu 300, 700: per il testo. +- Ubuntu Mono: per i blocchi di codice + +```css +@import url('https://fonts.googleapis.com/css2?family=Share:wght@700&family=Ubuntu+Mono&family=Ubuntu:wght@300;700&display=swap'); +``` diff --git a/assets/style.css b/assets/style.css index cc8227f..44b1d82 100644 --- a/assets/style.css +++ b/assets/style.css @@ -1,5 +1,12 @@ -@import url('https://fonts.googleapis.com/css2?family=Sen&family=Work+Sans:wght@700&display=swap'); + +@import url('https://fonts.googleapis.com/css2?family=Share:wght@700&family=Ubuntu+Mono&family=Ubuntu:wght@300;700&display=swap'); + +/* @import url('https://fonts.googleapis.com/css2?family=Sen&family=Work+Sans:wght@700&display=swap'); */ + +:root { + --accent-1: royalblue; +} * { box-sizing: border-box; @@ -16,19 +23,35 @@ body { display: flex; flex-direction: column; - font-family: 'Sen'; + font-family: 'Ubuntu', sans-serif; + font-weight: 300; + font-size: 17px; + line-height: 1.25; } h1, h2, h3, h4 { - font-family: 'Work Sans'; + font-family: 'Share', cursive; font-weight: 700; } +a, a:focus, a:visited { + color: #666; + text-decoration: #aaa underline; + padding: 1px 2px; + border-radius: 2px; +} + +a:hover { + background: var(--accent-1); + color: white; +} + body { max-width: 100%; width: 50rem; margin: 0 auto; - padding: 0 0.5em; + padding: 0 0.5rem; + overflow-y: scroll; } nav { @@ -51,17 +74,38 @@ nav { } .news-list > article { - margin: 1em; - /* padding: 1em; */ - /* background: greenyellow; */ + margin: 1rem; +} + +.nav-item:first-child { + font-size: 25px; } .nav-item { - margin: 1em 0.75em; + font-family: 'Share', cursive; + font-weight: 700; + + font-size: 21px; +} + +.nav-item:hover { + background: #f0f0f0; +} + +.nav-item a, .nav-item a:focus, .nav-item a:visited { + display: flex; + align-items: center; + justify-content: center; + + padding: 0 0.75rem; + height: 3.25rem; + + color: black; + text-decoration: none; } body > div:last-of-type { - margin-bottom: 20em; + margin-bottom: 20rem; } footer { @@ -69,7 +113,7 @@ footer { bottom: 0; left: 0; width: 100%; - height: 3em; + height: 3rem; display: flex; align-items: center; justify-content: center; diff --git a/auth.go b/auth.go index d2268d3..4689664 100644 --- a/auth.go +++ b/auth.go @@ -1,53 +1,53 @@ package main -import ( - "bytes" - "encoding/json" - "io/ioutil" - "log" - "net/http" -) - -// AuthenticationService è l'interfaccia del servizio di autenticazione sul server principale -type AuthenticationService struct { - URL string -} +// User as in auth-poisson +type User struct { + Username string + UID int -// NewAuthenticationService crea un nuovo servizio di autenticazione e controlla se è attivo -func NewAuthenticationService(url string) (*AuthenticationService, error) { - service := new(AuthenticationService) - service.URL = url + Name string + Surname string + FullName string - res, err := service.Get("status") + // ... +} - if err != nil { - return nil, err - } +// AuthService rappresenta un servizio di autenticazione +type AuthService interface { + GetUsers() []User - status, _ := ioutil.ReadAll(res.Body) + GetUser(username string) User - if string(status) != "online" { - log.Fatalf("Authentication service isn't online, status: '%s'", status) - } + // LoginUser if successful returns the token for this user that will be stored in an HTTP cookie. + LoginUser(username, password string) (string, error) +} - return service, nil +// LdapService ... +type LdapService struct { + URL string } -// Get ... -func (service *AuthenticationService) Get(url string) (*http.Response, error) { - return http.Get(service.URL + "/" + url) +// FakeService ... +type FakeService struct { + URL string } -// Authenticate ... -func (service *AuthenticationService) Authenticate(username, password string) bool { +// NewAuthenticationService crea un nuovo servizio di autenticazione e controlla se è attivo +// func NewAuthenticationService(url string) (*LdapService, error) { +// service := new(LdapService) +// service.URL = url - json, _ := json.Marshal(struct { - Username, Password string - }{username, password}) +// res, err := service.Get("status") - res, _ := http.Post(service.URL+"/auth", "application/json", bytes.NewReader(json)) +// if err != nil { +// return nil, err +// } - result, _ := ioutil.ReadAll(res.Body) +// status, _ := ioutil.ReadAll(res.Body) - return string(result) == "true" -} +// if string(status) != "true" { +// log.Fatalf("Authentication service isn't online, status: '%s'", status) +// } + +// return service, nil +// } diff --git a/blog/archetypes/default.md b/blog/archetypes/default.md index 00e77bd..248ba34 100644 --- a/blog/archetypes/default.md +++ b/blog/archetypes/default.md @@ -1,6 +1,8 @@ ---- -title: "{{ replace .Name "-" " " | title }}" -date: {{ .Date }} -draft: true ---- - ++++ +title = "{{ humanize .Name | title }}" +description = "" +author = "" +date = {{ .Date }} +tags = [] +draft = true ++++ diff --git a/blog/config.toml b/blog/config.toml index cfe7abb..3fabdce 100644 --- a/blog/config.toml +++ b/blog/config.toml @@ -1,7 +1,6 @@ -baseurl = "https://phc.dm.unipi.it/" +baseURL = "/blog/" title = "Blog del PHC" theme = "ghostwriter" -languageCode = "en-us" copyright = "PHC" pygmentsUseClasses = true pygmentsCodefences = true @@ -24,12 +23,14 @@ profile = "/page/contact" [taxonomies] tag = "tags" +category = "categories" +# Le categorie valide sono: "Guide", "Progetti" [params] mainSections = [ "post" ] intro = true headline = "Blog del PHC" -description = "Qui postiamo notizie importanti, progetti e qualche guida." +description = "[WIP - Lo stile è da cambiare!] Qui postiamo notizie importanti, progetti e qualche guida." github = "https://github.com/PHC-DM" email = "macchinisti@poisson.phc.dm.unipi.it" opengraph = true @@ -49,17 +50,22 @@ post = "/:year/:month/:day/:filename/" url = "/" weight = 1.0 + [[menu.main]] + name = "Guide" + url = "/categories/guide/" + weight = 2.0 + [[menu.main]] name = "Progetti" - url = "/project/" + url = "/categories/progetti/" weight = 2.0 [[menu.main]] name = "Contattaci" url = "/page/contact/" - weight = 3.0 + weight = 4.0 [[menu.main]] name = "About" url = "/page/about/" - weight = 4.0 \ No newline at end of file + weight = 5.0 \ No newline at end of file diff --git a/blog/content/post/come-usare-il-servizio-git.md b/blog/content/post/come-usare-il-servizio-git.md new file mode 100644 index 0000000..7d0ec9c --- /dev/null +++ b/blog/content/post/come-usare-il-servizio-git.md @@ -0,0 +1,11 @@ ++++ +title = "Come usare il servizio Git" +description = "Le base di git e come utilizzarlo con Poisson." +date = 2020-06-25T20:23:58+02:00 +categories = "Guide" +author = "???" ++++ + +# Come usare il serivizio Git + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean nec dolor in magna lobortis egestas. Suspendisse eu erat tempor, tristique neque eu, convallis nulla. Curabitur vel bibendum lacus, at semper mauris. Suspendisse aliquet commodo ex, sed sagittis metus aliquam id. Maecenas feugiat rutrum lorem vel imperdiet. Nullam ornare lectus ut enim finibus, et porttitor mi tincidunt. \ No newline at end of file diff --git a/blog/content/post/hugoisforlovers.md b/blog/content/post/hugoisforlovers.md index bcb92e6..f0f57f7 100755 --- a/blog/content/post/hugoisforlovers.md +++ b/blog/content/post/hugoisforlovers.md @@ -8,10 +8,6 @@ tags = [ "development", ] date = "2014-04-02" -categories = [ - "Development", - "golang", -] +++ ## Step 1. Install Hugo diff --git a/blog/content/post/nuovo-sito-di-poisson.md b/blog/content/post/nuovo-sito-di-poisson.md new file mode 100644 index 0000000..4e68c69 --- /dev/null +++ b/blog/content/post/nuovo-sito-di-poisson.md @@ -0,0 +1,11 @@ ++++ +title = "Annuncio nuovo sito del PHC" +description = "Un nuovo sito." +date = 2020-06-25T20:23:58+02:00 +categories = "Progetti" +author = "???" ++++ + +# Il nuovo sito del PHC + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean nec dolor in magna lobortis egestas. Suspendisse eu erat tempor, tristique neque eu, convallis nulla. Curabitur vel bibendum lacus, at semper mauris. Suspendisse aliquet commodo ex, sed sagittis metus aliquam id. Maecenas feugiat rutrum lorem vel imperdiet. Nullam ornare lectus ut enim finibus, et porttitor mi tincidunt. \ No newline at end of file diff --git a/blog/public/2014/04/02/goisforlovers/index.html b/blog/public/2014/04/02/goisforlovers/index.html index b883b0d..ef9d88f 100644 --- a/blog/public/2014/04/02/goisforlovers/index.html +++ b/blog/public/2014/04/02/goisforlovers/index.html @@ -13,9 +13,9 @@ - - - + + + @@ -32,10 +32,10 @@

- Blog del PHC + Blog del PHC

- + @@ -56,19 +56,23 @@ @@ -346,22 +350,22 @@ so, such as in this example:

Tagged: - go, + go, - golang, + golang, - templates, + templates, - themes, + themes, - development + development