Browse Source

(1) Add Project feature. (2) Fix exampleSite. (3) Various minor improvements.

George Cushen 9 năm trước cách đây
mục cha
commit
80c7d04015

+ 9 - 1
README.md

@@ -100,9 +100,17 @@ Then edit the newly created file `blog/my-article-name.md` with your full title
 
 You may use Markdown to format the content. Furthermore, code highlighting is allowed in case your news articles are related to discussing programming or computer science. An example can be seen in `themes/hugo-academic/exampleSite/example-post.md`. Note that post tagging is not currently used, but is a placeholder for a future update.
 
+### Create a project
+
+To create a project:
+
+    hugo new projects/my-project-name.md
+
+Then edit the newly created file `projects/my-project-name.md`. Either you can link the project to an external project website by setting the `external_link = "http://external-project.com"` variable at the top of the file, or you can add content (below the final `+++`) in order to render a project page on your website.
+
 ### Removing content
 
-Generally, to remove content, simply delete the relevant file from your `content/blog` or `content/publications` folder.
+Generally, to remove content, simply delete the relevant file from your `content/blog`, `content/publications`, or `content/projects` folder.
 
 Otherwise, to remove the Teaching section from the home page, simply delete the `content/home/teaching.md` file. Alternatively, you may re-purpose the section by editing the heading and contents within the file.
 

+ 1 - 1
archetypes/blog.md

@@ -1,3 +1,3 @@
 +++
-tags = [""]
+tags = []
 +++

+ 8 - 0
archetypes/projects.md

@@ -0,0 +1,8 @@
++++
+tags = []
+summary = ""
+img = ""
+img_preview = ""
+client_name = ""
+external_link = ""
++++

+ 11 - 2
exampleSite/config.toml

@@ -14,6 +14,10 @@ googleAnalytics = ""
     address = "Stanford AI Lab, Stanford University, California, 90210, USA."
     phone = "888 888 88 88"
 
+    # Date format (refer to Go's formatting options)
+    #   Examples: "Mon, Jan 2, 2006" or "2006-01-02"
+    date_format = "Mon, Jan 2, 2006"
+
     [[params.education]]
         course = "PhD in Artificial Intelligence"
         institution = "Stanford University"
@@ -70,12 +74,17 @@ googleAnalytics = ""
     url = "/#news"
     weight = 3
 
+[[menu.main]]
+    name = "Projects"
+    url = "/#projects"
+    weight = 4
+
 [[menu.main]]
     name = "Teaching"
     url = "/#teaching"
-    weight = 4
+    weight = 5
 
 [[menu.main]]
     name = "Contact"
     url = "/#contact"
-    weight = 5
+    weight = 6

+ 0 - 0
exampleSite/static/.gitkeep


BIN
images/screenshot.png


BIN
images/tn.png


+ 1 - 1
layouts/_default/list.html

@@ -5,7 +5,7 @@
     {{ range .Data.Pages }}
     <div>
         <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
-        <h4>{{ .Date.Format "Mon, Jan 2, 2006" }}</h4>
+        <h4>{{ .Date.Format .Site.Params.date_format }}</h4>
         <p>{{ .Summary }}</p>
     </div>
     {{ end }}

+ 2 - 2
layouts/_default/single.html

@@ -3,12 +3,12 @@
 <div class="container">
 
     <h1>{{ .Title }}</h1>
-    <h4>{{ .Date.Format "Mon, Jan 2, 2006" }}</h4>
+    {{ partial "article_metadata" . }}
     <div class="post">
         {{ .Content }}
     </div>
 
-    {{ partial "section_metadata.html" . }}
+    {{ partial "section_item_pager.html" . }}
 
     {{ partial "footer_container.html" . }}
 

+ 18 - 3
layouts/index.html

@@ -17,7 +17,7 @@
             {{ range first 5 (where .Data.Pages.ByDate "Section" "publications").Reverse }}
             <li>
                 <i class="fa-li fa fa-file-text-o pub-icon" aria-hidden="true"></i>
-                <span style="padding-right: 8px">{{ .Title | safeHTML }}</span>
+                <span style="padding-right: 8px">{{ .Title | markdownify }}</span>
                 <a class="btn btn-primary btn-outline btn-xs" href="{{ .Permalink }}">Details</a>
                 {{ with .Params.url_pdf }}<a class="btn btn-primary btn-outline btn-xs" href="{{ . }}">PDF</a>{{ end }}
                 {{ with .Params.url_code }}<a class="btn btn-primary btn-outline btn-xs" href="{{ . }}">Code</a>{{ end }}
@@ -34,9 +34,9 @@
     <section id="news">
         <h2>News</h2>
         {{ range last 5 (where .Data.Pages "Section" "=" "blog") }}
-        <div>
+        <div class="article-list-item">
             <h3 class="post-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h3>
-            <h4>{{ .Date.Format "Mon, Jan 2, 2006" }}</h4>
+            {{ partial "article_metadata" . }}
             <p>
                 {{ if .Truncated }}
                     {{ .Summary }}
@@ -51,6 +51,21 @@
     </section>
 
 
+    <section id="projects">
+        <h2>Projects</h2>
+        <ul class="fa-ul">
+        {{ range where .Data.Pages "Section" "=" "projects" }}
+            <li>
+                {{ if .Content }}<a href="{{ .Permalink }}">{{ else }}{{ with .Params.external_link }}<a href="{{ . }}">{{ end }}{{ end }}
+                <i class="fa-li fa fa-files-o pub-icon" aria-hidden="true"></i>
+                <span style="padding-right: 8px">{{ .Title | markdownify }}</span>
+                {{ if .Content }}</a >{{ else }}{{ with .Params.external_link }}</a>{{ end }}{{ end }}
+            </li>
+        {{ end }}
+        </ul>
+    </section>
+
+
     {{ range $index, $page := where .Site.Pages "Section" "=" "home" }}
     {{ if eq .Title "teaching" }}
     <section id="teaching">

+ 1 - 1
layouts/partials/header.html

@@ -11,7 +11,7 @@
     {{ with .Site.Params.role }}<meta name="description" content="{{ . }}" />{{ end }}
 
     <link rel="stylesheet" href="/css/bootstrap.min.css" />
-    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/styles/default.min.css">
+    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.3.0/styles/github.min.css">
     <link rel="stylesheet" href="/css/font-awesome.min.css" />
     <link rel="stylesheet" href="/css/academicons.min.css" />
     <link rel="stylesheet" href="/css/hugo-academic.css" />

+ 0 - 0
layouts/partials/section_metadata.html → layouts/partials/section_item_pager.html


+ 16 - 0
layouts/projects/single.html

@@ -0,0 +1,16 @@
+{{ partial "header.html" . }}
+{{ partial "navbar.html" . }}
+<div class="container">
+
+    <h1>{{ .Title }}</h1>
+    {{ with .Params.external_link }}<a class="btn btn-primary btn-outline" href="{{ . }}">Go to Project Site</a>{{ end }}
+    <div class="post">
+        {{ .Content }}
+    </div>
+
+    {{ partial "section_item_pager.html" . }}
+
+    {{ partial "footer_container.html" . }}
+
+</div>
+{{ partial "footer.html" . }}

+ 3 - 3
layouts/publications/single.html

@@ -6,8 +6,8 @@
         <div class="pub-title">
             <h1>{{ .Title }}</h1>
             <p class="citation_authors">
-                {{ range .Params.authors }}
-                <span class="citation_author">{{ . }}</span>
+                {{ with .Params.authors }}
+                {{ delimit . ", " }}
                 {{ end }}
             </p>
         </div>
@@ -65,7 +65,7 @@
 
     </div>
 
-    {{ partial "section_metadata.html" . }}
+    {{ partial "section_item_pager.html" . }}
     {{ partial "footer_container.html" . }}
 </div>
 {{ partial "footer.html" . }}

+ 0 - 0
layouts/section/projects.html


+ 34 - 4
static/css/hugo-academic.css

@@ -77,6 +77,23 @@ footer, footer p {
     color: #899596;
 }
 
+/*************************************************
+ *  Blog Articles
+ **************************************************/
+
+.article-metadata {
+    margin-bottom: 20px;
+}
+
+.article-list-item .article-metadata {
+    margin-bottom: 5px;
+}
+
+.article-metadata .article-date, .article-metadata .article-tags {
+    margin-right: 10px;
+    color: #888;
+}
+
 /*************************************************
  *  Publications
  **************************************************/
@@ -95,10 +112,6 @@ footer, footer p {
     font-style: italic;
 }
 
-.citation_authors .citation_author {
-    padding-right: 25px;
-}
-
 /* Note: a corresponding style appears further down, in @media for mobile screen size */
 .space-below {
     margin-bottom: 50px;
@@ -235,6 +248,23 @@ ul.ul-edu li .description p.institution {
     min-height:60px !important;
 }
 
+.navbar-default {
+    background: #fff;
+    -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.05);
+    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
+}
+
+.navbar-default .navbar-nav li a, .navbar-default .navbar-nav li a:visited {
+    white-space: nowrap;
+    -webkit-transition: 0.2s ease;
+    transition: 0.2s ease;
+    color: #565a5f;
+}
+
+.navbar-default .navbar-nav li a:hover {
+    color: #11aa66;
+}
+
 .navbar-brand, .navbar-nav li a {
     line-height: 60px;
     padding-top: 5px;

+ 3 - 3
theme.toml

@@ -1,10 +1,10 @@
 name = "Academic"
 license = "MIT"
 licenselink = "https://github.com/gcushen/hugo-academic/blob/master/LICENSE.md"
-description = "A personal academic staff and student theme for Hugo."
+description = "A one page personal theme for academic staff and students."
 homepage = "https://github.com/gcushen/hugo-academic"
-tags = ["academic", "research", "responsive", "student", "personal", "mobile", "blog", "minimal"]
-features = ["biography", "research interests", "research publication system", "blog"]
+tags = ["academic", "portfolio", "responsive", "student", "personal", "mobile", "blog", "minimal"]
+features = ["biography", "academic interests", "research publication system", "blog"]
 min_version = 0.15
 
 [author]