Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/vickylaixy/hugo-theme-introduction.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaximilian Bosche <snow2k9@users.noreply.github.com>2019-04-10 15:41:06 +0300
committerHanzei <16541325+hanzei@users.noreply.github.com>2019-04-10 15:41:06 +0300
commit5712e49125c893d18e6fea8d10494bacdc420c96 (patch)
tree7907b81766a6b547ca89b50716641ba50f79a165
parentf223f10314086913c43098ff1e38b35d3c81eb6b (diff)
Order sections on homepage by weigth (#143)
-rw-r--r--README.md2
-rw-r--r--exampleSite/content/de/blog/_index.md1
-rw-r--r--exampleSite/content/de/home/about.md2
-rw-r--r--exampleSite/content/de/home/lorem.md2
-rw-r--r--exampleSite/content/de/projects/_index.md1
-rw-r--r--exampleSite/content/en/blog/_index.md3
-rw-r--r--exampleSite/content/en/home/about.md4
-rw-r--r--exampleSite/content/en/home/lorem.md2
-rw-r--r--exampleSite/content/en/projects/_index.md3
-rw-r--r--exampleSite/content/es/blog/_index.md1
-rw-r--r--exampleSite/content/es/home/about.md2
-rw-r--r--exampleSite/content/es/home/lorem.md2
-rw-r--r--exampleSite/content/es/projects/_index.md1
-rw-r--r--layouts/index.html22
14 files changed, 33 insertions, 15 deletions
diff --git a/README.md b/README.md
index 8390978..a01edaf 100644
--- a/README.md
+++ b/README.md
@@ -95,6 +95,7 @@ hugo new projects/_index.md
```
Add a `title` and some optional content to the file.
+Add an optional `weight` for ordering projects section.
To create a project, run:
@@ -122,6 +123,7 @@ Create an index file for the blog:
```
hugo new blog/_index.md
```
+Add an optional `weight` for ordering blog section on your homepage
Create a new blog post with:
diff --git a/exampleSite/content/de/blog/_index.md b/exampleSite/content/de/blog/_index.md
index 8288dbd..a994abb 100644
--- a/exampleSite/content/de/blog/_index.md
+++ b/exampleSite/content/de/blog/_index.md
@@ -1,5 +1,6 @@
---
title: "Blog"
+weight: 20
---
Ein Einleitungstext für meinen Blog
diff --git a/exampleSite/content/de/home/about.md b/exampleSite/content/de/home/about.md
index 7c9b833..a4c38e1 100644
--- a/exampleSite/content/de/home/about.md
+++ b/exampleSite/content/de/home/about.md
@@ -1,7 +1,7 @@
---
title: "Über mich"
image: "profile.jpg"
-weight: 0
+weight: 8
---
Dies ist **Vorstellung**, ein minimales Webseiten Theme für [Hugo](https://gohugo.io)
diff --git a/exampleSite/content/de/home/lorem.md b/exampleSite/content/de/home/lorem.md
index 17ffc75..04d7cb2 100644
--- a/exampleSite/content/de/home/lorem.md
+++ b/exampleSite/content/de/home/lorem.md
@@ -1,6 +1,6 @@
---
title: "Lorem Ipsum"
-weight: 1
+weight: 30
---
Weitere Abschnitte für die Hauptseiten können hinzugefügt werden, indem Datein unter `content/home/` erstellt werden.
diff --git a/exampleSite/content/de/projects/_index.md b/exampleSite/content/de/projects/_index.md
index 58ed7d2..8e8ff68 100644
--- a/exampleSite/content/de/projects/_index.md
+++ b/exampleSite/content/de/projects/_index.md
@@ -1,5 +1,6 @@
---
title: "Projekte"
+weight: 10
---
Ein Einleitungstext für meinen Projekte
diff --git a/exampleSite/content/en/blog/_index.md b/exampleSite/content/en/blog/_index.md
index 1ecac4c..a7c2af2 100644
--- a/exampleSite/content/en/blog/_index.md
+++ b/exampleSite/content/en/blog/_index.md
@@ -1,5 +1,6 @@
---
title: "Blog"
+weight: 20
---
-Here is some introduction text for my blog. You can set this text in the `/blog/_index.md` file. This page uses the `/layouts/blog/list.html` template. \ No newline at end of file
+Here is some introduction text for my blog. You can set this text in the `/blog/_index.md` file. This page uses the `/layouts/blog/list.html` template.
diff --git a/exampleSite/content/en/home/about.md b/exampleSite/content/en/home/about.md
index 6052d61..4161ab4 100644
--- a/exampleSite/content/en/home/about.md
+++ b/exampleSite/content/en/home/about.md
@@ -1,7 +1,7 @@
---
title: "About"
image: "profile.jpg"
-weight: 0
+weight: 8
---
This is **Introduction**, a minimalist website theme made for [Hugo](https://gohugo.io).
@@ -14,4 +14,4 @@ This is **Introduction**, a minimalist website theme made for [Hugo](https://goh
* Any number of custom index page sections from Markdown files
* _Projects_ section with any number of projects: highly configurable as a photo gallery, modals, or external links
* _Blog_ section with optional _Latest Post_, on the main page or as a separate section
-* Styled Markdown throughout with support for Hugo's syntax highlighting \ No newline at end of file
+* Styled Markdown throughout with support for Hugo's syntax highlighting
diff --git a/exampleSite/content/en/home/lorem.md b/exampleSite/content/en/home/lorem.md
index 824b327..5f57592 100644
--- a/exampleSite/content/en/home/lorem.md
+++ b/exampleSite/content/en/home/lorem.md
@@ -1,6 +1,6 @@
---
title: "Lorem Ipsum"
-weight: 1
+weight: 30
---
You can add more sections to the home page by adding files to the `/content/home/` folder.
diff --git a/exampleSite/content/en/projects/_index.md b/exampleSite/content/en/projects/_index.md
index fdac72b..ca0a749 100644
--- a/exampleSite/content/en/projects/_index.md
+++ b/exampleSite/content/en/projects/_index.md
@@ -1,5 +1,6 @@
---
title: "Projects"
+weight: 10
---
-Here is some introduction text for my projects. You can set this text in the `/projects/_index.md` file. This page uses the `/layouts/projects/list.html` template. \ No newline at end of file
+Here is some introduction text for my projects. You can set this text in the `/projects/_index.md` file. This page uses the `/layouts/projects/list.html` template.
diff --git a/exampleSite/content/es/blog/_index.md b/exampleSite/content/es/blog/_index.md
index e95a00c..a62ffc0 100644
--- a/exampleSite/content/es/blog/_index.md
+++ b/exampleSite/content/es/blog/_index.md
@@ -1,5 +1,6 @@
---
title: "Blog"
+weight: 20
---
Este es un texto introductorio para mi blog.
diff --git a/exampleSite/content/es/home/about.md b/exampleSite/content/es/home/about.md
index 7c6ab52..30a4676 100644
--- a/exampleSite/content/es/home/about.md
+++ b/exampleSite/content/es/home/about.md
@@ -1,7 +1,7 @@
---
title: "Sobre"
image: "profile.jpg"
-weight: 0
+weight: 8
---
Esto es **Introducción**, un tema mínimo con desplazamiento para sitios web hechos con [Hugo](https://gohugo.io).
diff --git a/exampleSite/content/es/home/lorem.md b/exampleSite/content/es/home/lorem.md
index f26ef4a..042bb42 100644
--- a/exampleSite/content/es/home/lorem.md
+++ b/exampleSite/content/es/home/lorem.md
@@ -1,6 +1,6 @@
---
title: "Lorem Ipsum"
-weight: 1
+weight: 30
---
You can add more sections to the home page by adding file to `content/home/`
diff --git a/exampleSite/content/es/projects/_index.md b/exampleSite/content/es/projects/_index.md
index 31e8f35..159bb80 100644
--- a/exampleSite/content/es/projects/_index.md
+++ b/exampleSite/content/es/projects/_index.md
@@ -1,5 +1,6 @@
---
title: "Proyectos"
+weight: 10
---
Este es un texto introductorio para mis proyectos.
diff --git a/layouts/index.html b/layouts/index.html
index ddbbb04..494e0d0 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -42,9 +42,22 @@
</section> <!-- Done with Hero -->
{{ with .Site.GetPage "/home" }}
+
+ {{ $blog := .Site.GetPage "/blog" }}
+ {{ $projects := .Site.GetPage "/projects" }}
{{ $home := . }}
- {{ range sort (.Resources.ByType "page") "Params.weight" }}
+
+ {{ $pages := sort (.Resources.ByType "page" | append $blog | append $projects) "Params.weight" }}
+ {{ range $pages }}
{{ if ne .Name "contact.md" }}
+ {{ if eq .File.Dir "projects/" }}
+ <!-- Now for some cool projects -->
+ {{ partial "home/projects.html" . }}
+ {{ else if eq .File.Dir "blog/" }}
+ <!-- Let`s show some blog posts -->
+ {{ partial "home/blog.html" . }}
+ {{ else }}
+
<!-- Range through all sections in /home execept contact.md -->
<div class="section" id="{{ .File.TranslationBaseName }}">
<div class="container">
@@ -76,10 +89,7 @@
</div>
{{ end }}
{{ end }}
- <!-- Now for some cool projects -->
- {{ partial "home/projects.html" . }}
- <!-- Let`s show some blog posts -->
- {{ partial "home/blog.html" . }}
+ {{ end }}
<!-- Let`s chat, shall we? -->
{{ with .Resources.GetMatch "contact.md" }}
<div class="section" id="{{ .File.TranslationBaseName }}">
@@ -124,4 +134,4 @@
{{ end }}
</body>
-</html> \ No newline at end of file
+</html>