diff --git a/README.md b/README.md index 40782bd..9d0edc6 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,14 @@ You can install it as the [HUGO documentation][4] recommends. ## Configuration +### List of last posts on the homepage + +If you want the 5 last posts being listed on the homepage, add the +`home_post_list` to the configuration. Set it to true. + ### Personal and professional description -The front page displays, if it exists, the content of the main index markdown +The homepage displays, if it exists, the content of the main index markdown file that could be placed at the root of the content directory [[HUGO's documentation][3]]. diff --git a/assets/scss/_lists.scss b/assets/scss/_lists.scss index c6add17..8c1cc70 100644 --- a/assets/scss/_lists.scss +++ b/assets/scss/_lists.scss @@ -15,6 +15,24 @@ } } +/* List of last posts, on the home page*/ +.home-posts-list { + + padding-bottom: var(--pico-spacing); + border-bottom: var(--pico-muted-border-color) solid var(--pico-border-width); + + article { + display: inline-block; + } + + article:not(:last-child) { + &::after { + content: ' / '; + white-space: pre; + } + } +} + /* Lists of the main page, for contact */ .home-lists { diff --git a/i18n/en.toml b/i18n/en.toml index ad6651e..2116ee7 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -8,6 +8,7 @@ defaultImageAlt = "Grayish sheep portrait" e-mail = "e-mail" fingerprint = "Fingerprint" lastCommit = "Last commit modifying this page" +lastPosts = "Last Posts" lastUpdate = "Last update" mobile = "Mobile" online = "Online" diff --git a/i18n/fr.toml b/i18n/fr.toml index be0a82f..00e040d 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -8,6 +8,7 @@ defaultImageAlt = "Portrait de mouton en nuances de gris" e-mail = "e-mail" fingerprint = "Empreinte" lastCommit = "Dernier commit modifiant cette page" +lastPosts = "Derniers billets" lastUpdate = "Dernière mise à jour " mobile = "Téléphone mobile" online = "En ligne" diff --git a/layouts/_default/home.html b/layouts/_default/home.html new file mode 100644 index 0000000..add0c47 --- /dev/null +++ b/layouts/_default/home.html @@ -0,0 +1,33 @@ +{{ define "main" }} + + {{ if .Site.Params.home_post_list }} +
+

{{ i18n "lastPosts" }}

+ + {{ range first 5 .Site.RegularPages.ByPublishDate.Reverse }} +
+ + {{- .Title -}} + +
+ {{ end }} +
+ {{ end }} +
+ + {{.Content}} + {{ if .Site.Params.online }} + {{ partial "online" . }} + {{ end }} + {{ if .Site.Params.contactsPriv }} + {{ partial "perso" .}} + {{ end }} + {{ if .Site.Params.contactsPro }} + {{ partial "pro" . }} + {{ end }} +
+{{ end }} diff --git a/layouts/index.html b/layouts/index.html deleted file mode 100644 index baf93d7..0000000 --- a/layouts/index.html +++ /dev/null @@ -1,14 +0,0 @@ -{{ define "main" }} - - {{.Content}} - {{ if .Site.Params.online }} - {{ partial "online" . }} - {{ end }} - {{ if .Site.Params.contactsPriv }} - {{ partial "perso" .}} - {{ end }} - {{ if .Site.Params.contactsPro }} - {{ partial "pro" . }} - {{ end }} - -{{ end }}