Merge pull request #15 from sjp38/support_tag

Support tags
This commit is contained in:
Michael Romero 2017-02-25 19:49:00 -08:00 committed by GitHub
commit 01e8d98e0a
6 changed files with 121 additions and 5 deletions

View File

@ -50,4 +50,9 @@ pygmentCodeFences = true
[[menu.main]]
parent = "samples"
name = "Test Markdown"
url = "/post/2015-02-20-test-markdown"
url = "/post/2015-02-20-test-markdown"
[[menu.main]]
name = "Tags"
url = "/tags"
weight = 3

View File

@ -2,6 +2,7 @@
title: Test markdown
subtitle: Each post also has a subtitle
date: 2015-02-20
tags: ["example", "markdown"]
---
You can write regular [markdown](http://markdowntutorial.com/) here and Jekyll will automatically convert it to a nice webpage. I strongly encourage you to [take 5 minutes to learn how to write in markdown](http://markdowntutorial.com/) - it'll teach you how to transform regular text into bold/italics/headings/tables/etc.
@ -49,4 +50,4 @@ var foo = function(x) {
return(x + 5);
}
foo(3)
{{</ highlight >}}
{{</ highlight >}}

View File

@ -2,6 +2,7 @@
title: Code Sample
subtitle: Using Pygments or Highlight.js
date: 2016-03-08
tags: ["example", "code"]
---
The following are two code samples using syntax highlighting.
@ -27,4 +28,4 @@ The following is a code sample using triple backticks ( ``` ) code fencing provi
num2 = prompt("Enter second number")
sum = parseInt(num1) + parseInt(num2) // "+" means "add"
alert("Sum = " + sum) // "+" means combine into a string
```
```

View File

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="en">
{{ partial "head.html" . }}
<body>
{{ partial "nav.html" . }}
<header class="header-section ">
<div class="intro-header no-img">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="page-heading">
<h2>#{{ .Title }}</h2>
</div>
</div>
</div>
</div>
</div>
</header>
<div class="container" role="main">
{{ $pag := .Paginate (where .Data.Pages "Type" "post") }}
{{ range $pag.Pages }}
<article class="post-preview">
<a href="{{ .Permalink }}">
<h2 class="post-title">{{ .Title }}</h2>
{{ if .Params.subtitle }}
<h3 class="post-subtitle">
{{ .Params.subtitle }}
</h3>
{{ end }}
</a>
<p class="post-meta">
Posted on {{ .Date.Format "January 2, 2006" }}
</p>
<div class="post-entry">
{{ if .Truncated }}
{{ .Summary }}
<a href="{{ .Permalink }}" class="post-read-more">[Read&nbsp;More]</a>
{{ else }}
{{ .Content }}
{{ end }}
</div>
{{ if .Params.tags }}
<span class="post-meta">
{{ range .Params.tags }}
#<a href="/tags/{{ . | urlize }}">{{ . }}</a>&nbsp;
{{ end }}
</span>
{{ end }}
</article>
{{ end }}
</div>
</div>
{{ partial "footer.html" . }}
</body>
</html>

View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
{{ partial "head.html" . }}
<body>
{{ partial "nav.html" . }}
<header class="header-section ">
<div class="intro-header no-img">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="page-heading">
<h2>{{ .Title }}</h2>
</div>
</div>
</div>
</div>
</div>
</header>
<div class="container" role="main">
<article class="post-preview">
{{ range $key, $value := .Data.Terms.ByCount }}
<li>
<a href="/tags/{{ $value.Name | urlize }}">
{{ $value.Name }}({{ $value.Count }})</a>
</li>
{{ end }}
</article>
</div>
</body>
</html>

View File

@ -46,7 +46,6 @@
<p class="post-meta">
Posted on {{ .Date.Format "January 2, 2006" }}
</p>
<div class="post-entry">
{{ if .Truncated }}
{{ .Summary }}
@ -55,7 +54,15 @@
{{ .Content }}
{{ end }}
</div>
{{ if .Params.tags }}
<span class="post-meta">
{{ range .Params.tags }}
#<a href="/tags/{{ . | urlize }}">{{ . }}</a>&nbsp;
{{ end }}
</span>
{{ end }}
</article>
{{ end }}
</div>