Skip to content

Commit

Permalink
feat: add tags page
Browse files Browse the repository at this point in the history
  • Loading branch information
nodejh committed Feb 27, 2021
1 parent 4815a95 commit 7a9d022
Show file tree
Hide file tree
Showing 8 changed files with 246 additions and 61 deletions.
30 changes: 30 additions & 0 deletions layouts/_default/list copy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{ partial "head.html" . }}
<body>
{{ partial "navigation.html" . }}
{{ partial "profile.html" . }}

<section id="wrapper" class="home">
{{ range .Data.Pages.GroupByDate "2006" }}
<div class="archive">
<h3>{{ .Key }}</h3>
<ul>
{{ range .Pages }}
<div class="post-item">
<div class="post-time">{{ .Date.Format "Jan 2" }}</div>
<a href="{{ .Permalink }}" class="post-link">
{{ .Title }}
</a>
</div>
{{ end }}
</ul>
</div>
{{ end }}
{{ partial "footer.html" . }}
</section>

<div class="dd">
</div>

{{ partial "js.html" . }}
</body>
</html>
62 changes: 35 additions & 27 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
{{ partial "head.html" . }}
<body>
{{ partial "navigation.html" . }}
{{ partial "profile.html" . }}
{{ define "main" }}
{{ partial "profile.html" . }}

<section id="wrapper" class="home">
{{ range .Data.Pages.GroupByDate "2006" }}
<div class="archive">
<h3>{{ .Key }}</h3>
<ul>
{{ range .Pages }}
<div class="post-item">
<div class="post-time">{{ .Date.Format "Jan 2" }}</div>
<a href="{{ .Permalink }}" class="post-link">
{{ .Title }}
</a>
</div>
{{ end }}
</ul>
</div>
{{ end }}
{{ partial "footer.html" . }}
</section>
<section id="archive">
{{ range .Data.Pages.GroupByDate "2006" }}
<div class="group">
<h3 class="key">
{{ .Key }}
</h3>

<div class="dd">
</div>
{{ range .Pages }}
<div class="value">
<div class="date">
{{ .Date.Format "Jan 2" }}
</div>
<div class="title">
<a href="{{ .Permalink }}">
{{ .Title }}
</a>

{{ partial "js.html" . }}
</body>
</html>
{{ with .Params.tags }}
<div class="tags">
{{ range . }}
<a href="{{ "tags/" | absURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
</div>
{{ end}}
</div>
</div>
{{ end }}
</div>
{{ end }}


</section>


{{ end }}
8 changes: 8 additions & 0 deletions layouts/_default/section.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{ define "main" }}
{{ partial "profile.html" . }}

<section id="section">
{{ .Content }}
</section>

{{ end }}
38 changes: 38 additions & 0 deletions layouts/_default/taxonomy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{ define "main" }}
{{ partial "profile.html" . }}

<section id="archive">
{{ range .Data.Pages.GroupByDate "2006" }}
<div class="group">
<h3 class="key">
{{ .Key }}
</h3>

{{ range .Pages }}
<div class="value">
<div class="date">
{{ .Date.Format "Jan 2" }}
</div>
<div class="title">
<a href="{{ .Permalink }}">
{{ .Title }}
</a>

{{ with .Params.tags }}
<div class="tags">
{{ range . }}
<a href="{{ "tags/" | absURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
</div>
{{ end}}
</div>
</div>
{{ end }}
</div>
{{ end }}


</section>


{{ end }}
27 changes: 27 additions & 0 deletions layouts/_default/terms copy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{ partial "head.html" . }}
<body>
{{ partial "navigation.html" . }}
{{ partial "profile.html" . }}

<section id="wrapper" class="tags">
<div class="page-tags">
<ul>
{{ $data := .Data }}
{{ range $key, $value := .Data.Terms.ByCount }}
{{ if ($value.Name) }}
<li>
<a href="{{ $.Site.BaseURL }}{{ $data.Plural }}/{{ $value.Name | urlize }}">
{{ $value.Name | upper }} <span>({{ $value.Count }})</span>
</a>

</li>
{{ end }}
{{ end }}
</ul>
</div>
{{ partial "footer.html" . }}
</section>

{{ partial "js.html" . }}
</body>
</html>
43 changes: 15 additions & 28 deletions layouts/_default/terms.html
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
{{ partial "head.html" . }}
<body>
{{ partial "navigation.html" . }}
{{ partial "profile.html" . }}


<section id="wrapper" class="tags">
<div class="page-tags">
<ul>
{{ $data := .Data }}
{{ range $key, $value := .Data.Terms.ByCount }}
{{ if ($value.Name) }}
<li>
<a href="{{ $.Site.BaseURL }}{{ $data.Plural }}/{{ $value.Name | urlize }}">
{{ $value.Name | upper }} <span>({{ $value.Count }})</span>
</a>

</li>
{{ end }}
{{ end }}
</ul>
</div>
{{ partial "footer.html" . }}
</section>

{{ partial "js.html" . }}
</body>
</html>
{{ define "main" }}
{{ partial "profile.html" . }}
<section id="tags">
{{ $data := .Data }}
{{ range $key, $value := .Data.Terms.ByCount }}
{{ if ($value.Name) }}
<span class="tag">
<a href="{{ $.Site.BaseURL }}{{ $data.Plural }}/{{ $value.Name | urlize }}">
{{ $value.Name | upper }} <span>({{ $value.Count }})</span>
</a>
</span>
{{ end }}
{{ end }}
</section>
{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{ partial "navigation.html" . }}
{{ partial "profile.html" . }}

<section id="wrapper" class="home">
<section id="about" class="home">
{{ .Content }}

{{ if .Site.Params.enableDisqus }}
Expand Down
97 changes: 92 additions & 5 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,16 @@ nav.navigation a.button {
font-weight: 400;
letter-spacing: 0px;
font-size: 20px;
color: #222;
margin-top: 12px;
color: #404040;
margin-bottom: 0;
margin-top: 0;
}

.profile h2 {
font-size: 20px;
font-weight: 300;
color: #757575;
margin-top: 10px;
margin-top: 0;
}

/* index post list */
Expand All @@ -261,15 +262,15 @@ nav.navigation a.button {

#list-page .title {
display: inline-block;
color: #333;
color: #404040;
font-size: 20px;
font-weight: 400;
margin: 0;
width: 80%;
}

#list-page .title a {
color: #333;
color: #404040;
display: block;
}

Expand Down Expand Up @@ -365,4 +366,90 @@ nav.navigation a.button {
font-size: 14px;
margin-right: 3px;
}
#single .tags a:hover {
color: #0366d6;
}


#archive {
max-width: 580px;
margin: 0 auto;
padding: 0 24px;
}

#archive .total {
font-size: 15px;
}

#archive .group {
margin: 24px auto;
}
#archive .group .key {
font-size: 20px;
margin-bottom: 12px;
}
#archive .group .value {
display: block;
font-size: 16px;
margin-bottom: 12px;
}
#archive .group .value .date {
display: inline-block;
color: #999;
width: 60px;
}
#archive .group .value .title {
display: inline;
}
#archive .group .value .title a {
color:#404040;
}
#archive .group .value .title a:hover {
color: #0366d6;
}
#archive .group .value .tags {
display: inline;
margin-left: 7px;
}
#archive .group .value .tags a {
background: #f2f2f2;
padding: 4px 7px;
color: #999;
font-size: 14px;
margin-right: 3px;
}
#archive .group .value .tags a:hover {
color: #0366d6;
}

/* taxonomy */
#tags {
max-width: 700px;
margin: 48px auto 0 auto;
padding: 0 12px;
text-align: center;
}

#tags .tag {
display: inline-block;
display: inline-block;
margin: 7px 12px;
}
#tags .tag a {
background: #f2f2f2;
padding: 4px 7px;
color: #757575;
color: #404040;
font-size: 14px;
margin-right: 3px;
}
#tags .tag a:hover {
color: #0366d6;
}

/* section page */
#section {
max-width: 580px;
margin: 48px auto 0 auto;
padding: 0 12px;
}

0 comments on commit 7a9d022

Please sign in to comment.