瀏覽代碼

:sparkles: Update layouts and fix JS

George Cushen 9 年之前
父節點
當前提交
5985996691

+ 3 - 3
layouts/404.html

@@ -5,15 +5,15 @@
     <h1>Page not found</h1>
     <p>Maybe you were looking for one of these?</p>
 
-    <h2>Recent News</h2>
-    {{ range last 20 (where .Data.Pages "Section" "=" "blog") }}
+    <h2>Recent Posts</h2>
+    {{ range last 20 (where .Data.Pages "Section" "=" "post") }}
     <ul>
         <li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
     </ul>
     {{ end }}
 
     <h2>Recent Publications</h2>
-    {{ range last 20 (where .Data.Pages "Section" "=" "publications") }}
+    {{ range last 20 (where .Data.Pages "Section" "=" "publication") }}
     <ul>
         <li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
     </ul>

+ 3 - 0
layouts/_default/single.html

@@ -4,12 +4,15 @@
 
     <h1>{{ .Title }}</h1>
     {{ partial "article_metadata" . }}
+
     <div class="post">
         {{ .Content }}
     </div>
 
     {{ partial "section_item_pager.html" . }}
 
+    {{ partial "comments.html" . }}
+
     {{ partial "footer_container.html" . }}
 
  </div>

+ 0 - 1
layouts/_default/teaching.html

@@ -1 +0,0 @@
-{{ .Content }}

+ 89 - 52
layouts/index.html

@@ -2,84 +2,121 @@
 {{ partial "navbar.html" . }}
 <div class="container">
 
+    <!-- Biography Section -->
     {{ range $index, $page := where .Site.Pages "Section" "=" "home" }}
     {{ if eq .Title "about" }}
-    <section id="bio">
-        {{ .Render "bio" }}
+    <section id="bio" class="home-section-wrapper full_width home alt" style="padding-top: 0;">
+        {{ partial "home_biography" . }}
     </section>
     {{ end }}
     {{ end }}
 
 
-    <section id="publications">
-        <h2>Recent Publications</h2>
-        <ul class="fa-ul">
-            {{ 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 | 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 }}
-                {{ with .Params.url_dataset }}<a class="btn btn-primary btn-outline btn-xs" href="{{ . }}">Dataset</a>{{ end }}
-                {{ with .Params.url_project }}<a class="btn btn-primary btn-outline btn-xs" href="{{ . }}">Project</a>{{ end }}
-                {{ range .Params.url_custom }}<a class="btn btn-primary btn-outline btn-xs" href="{{ .url }}">{{ .name }}</a>{{ end }}
-            </li>
-            {{ end }}
-        </ul>
-        <p class="text-right"><a href="/publications/">More Publications <i class="fa fa-angle-double-right" style="padding-left: 5px;"></i></a></p>
+    <!-- Publications Section -->
+    <section id="publications" class="home-section-wrapper full_width home">
+        <div class="row">
+            <div class="col-xs-12 col-md-4">
+                <h2>Recent Publications</h2>
+                <p><a href="/publication/">More Publications <i class="fa fa-angle-double-right" style="padding-left: 5px;"></i></a></p>
+            </div>
+            <div class="col-xs-12 col-md-8">
+                <ul class="fa-ul">
+                    {{ range first 5 (where .Data.Pages.ByDate "Section" "publication").Reverse }}
+                    <li>
+                        <i class="fa-li fa fa-file-text-o pub-icon" aria-hidden="true"></i>
+                        <span style="padding-right: 8px">{{ .Title | markdownify }}</span>
+                        <p>{{ partial "publication_list_buttons" . }}</p>
+                    </li>
+                    {{ end }}
+                </ul>
+            </div>
+        </div>
     </section>
 
 
-    <section id="news">
-        <h2>News</h2>
-        {{ range last 5 (where .Data.Pages "Section" "=" "blog") }}
-        <div class="article-list-item">
-            <h3 class="post-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h3>
-            {{ partial "article_metadata" . }}
-            <p>
-                {{ if .Truncated }}
-                    {{ .Summary }}
-                    <a href="{{ .RelPermalink }}">Read More <i class="fa fa-angle-double-right" style="padding-left: 5px;"></i></a>
-                {{ else }}
-                    {{ .Content }}
+    <!-- Blog Posts Section -->
+    <section id="posts" class="home-section-wrapper full_width home alt">
+        <div class="row">
+            <div class="col-xs-12 col-md-4">
+                <h2>Posts</h2>
+                <p><a href="/post/">More Posts <i class="fa fa-angle-double-right" style="padding-left: 5px;"></i></a></p>
+            </div>
+            <div class="col-xs-12 col-md-8">
+                {{ range last 5 (where .Data.Pages "Section" "=" "post") }}
+                <div class="article-list-item">
+                    <h3 class="post-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h3>
+                    {{ partial "article_metadata_compact" . }}
+                    <p>
+                        {{ if .Truncated }}
+                            {{ .Summary }}
+                        {{ else }}
+                            {{ .Content | markdownify }}
+                        {{ end }}
+                    </p>
+                    <p class="read-more">
+                        <a href="{{ .Permalink }}" class="btn btn-primary btn-outline">Read more</a>
+                    </p>
+                </div>
                 {{ end }}
-            </p>
+            </div>
         </div>
-        {{ end }}
-        <p class="text-right"><a href="/blog/">More Posts <i class="fa fa-angle-double-right" style="padding-left: 5px;"></i></a></p>
     </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>
+    <!-- Projects Section -->
+    <section id="projects" class="home-section-wrapper full_width home">
+        <div class="row">
+            <div class="col-xs-12 col-md-4">
+                <h2>Projects</h2>
+            </div>
+            <div class="col-xs-12 col-md-8">
+                <ul class="fa-ul">
+                {{ range where .Data.Pages "Section" "=" "project" }}
+                    <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>
+            </div>
+        </div>
     </section>
 
 
+    <!-- Custom Sections -->
     {{ range $index, $page := where .Site.Pages "Section" "=" "home" }}
-    {{ if eq .Title "teaching" }}
-    <section id="teaching">
-        {{ .Render "teaching" }}
+    {{ if and (isset .Params "section_id") (not (eq .Params.section_id 0)) }}
+    {{ $title_words := split $page.Title " " }}
+    <section id="{{ range $k, $v := $title_words }}{{ if eq $k 0 }}{{ . | urlize | lower }}{{ end }}{{ end }}" class="home-section-wrapper full_width home alt">
+        <div class="row">
+            <div class="col-xs-12 col-md-4">
+                <h2>{{ title $page.Title }}</h2>
+            </div>
+            <div class="col-xs-12 col-md-8">
+                {{ $page.Content }}
+            </div>
+        </div>
     </section>
     {{ end }}
     {{ end }}
 
 
-    <section id="contact">
-        <h2>Contact</h2>
-        {{ partial "contact.html" . }}
+    <!-- Contact Section -->
+    <section id="contact" class="home-section-wrapper full_width home">
+        <div class="row">
+            <div class="col-xs-12 col-md-4">
+                <h2>Contact</h2>
+            </div>
+            <div class="col-xs-12 col-md-8">
+                {{ partial "home_contact.html" . }}
+            </div>
+        </div>
     </section>
 
+
+    <!-- Page Footer -->
     {{ partial "footer_container.html" . }}
 
 </div>

+ 6 - 3
layouts/partials/article_metadata.html

@@ -1,7 +1,6 @@
 <div class="article-metadata">
 
     <span class="article-date">
-        <i class="fa fa-calendar"></i>
         <time datetime="{{ .Date }}" itemprop="datePublished">{{ .Date.Format .Site.Params.date_format }}</time>
     </span>
 
@@ -11,11 +10,15 @@
     <span class="article-tags">
         <i class="fa fa-tags"></i>
         {{ range $k, $v := .Params.tags }}
-        <a class="article-tag-link" href="{{ $.Site.BaseURL }}tags/{{ . | urlize | lower }}">{{ . }}</a>
-        {{ if lt $k (sub $tagsLen 1) }}, {{ end }}
+        <a class="article-tag-link" href="{{ $.Site.BaseURL }}tags/{{ . | urlize | lower }}">{{ . }}</a>{{ if lt $k (sub $tagsLen 1) }}, {{ end }}
         {{ end }}
     </span>
     {{ end }}
     {{ end }}
 
+
+    <div class="pull-right">
+        {{ partial "share.html" . }}
+    </div>
+
 </div>

+ 19 - 0
layouts/partials/article_metadata_compact.html

@@ -0,0 +1,19 @@
+<div class="article-metadata">
+
+    <span class="article-date">
+        <time datetime="{{ .Date }}" itemprop="datePublished">{{ .Date.Format .Site.Params.date_format }}</time>
+    </span>
+
+    {{ if isset .Params "tags" }}
+    {{ $tagsLen := len .Params.tags }}
+    {{ if gt $tagsLen 0 }}
+    <span class="article-tags">
+        <i class="fa fa-tags"></i>
+        {{ range $k, $v := .Params.tags }}
+        <a class="article-tag-link" href="{{ $.Site.BaseURL }}tags/{{ . | urlize | lower }}">{{ . }}</a>{{ if lt $k (sub $tagsLen 1) }}, {{ end }}
+        {{ end }}
+    </span>
+    {{ end }}
+    {{ end }}
+
+</div>

+ 7 - 0
layouts/partials/comments.html

@@ -0,0 +1,7 @@
+{{ if not (isset .Site.Params "disable_comments") }}
+<section id="comments">
+    <div id="disqus_thread">
+        {{ template "_internal/disqus.html" . }}
+    </div>
+</section>
+{{ end }}

+ 4 - 0
layouts/partials/footer.html

@@ -1,4 +1,6 @@
         <script src="/js/jquery-1.12.3.min.js"></script>
+        <script src="//cdnjs.cloudflare.com/ajax/libs/gsap/1.18.4/TweenMax.min.js"></script>
+        <script src="//cdnjs.cloudflare.com/ajax/libs/gsap/latest/plugins/ScrollToPlugin.min.js"></script>
         <script src="/js/bootstrap.min.js"></script>
         <script src="/js/hugo-academic.js"></script>
 
@@ -31,10 +33,12 @@
         <script>hljs.initHighlightingOnLoad();</script>
 
         <!-- LaTeX math rendering -->
+        {{ if and (isset .Params "math") (eq .Params.math true) }}
         <script type="text/x-mathjax-config">
             MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$'], ['\\(','\\)']] } });
         </script>
         <script async src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML"></script>
+        {{ end }}
 
     </body>
 </html>

+ 5 - 4
layouts/partials/footer_container.html

@@ -1,11 +1,12 @@
 <footer class="site-footer">
     <div class="inner">
-        <p>
+        <p class="powered-by">
 
-            Powered by the <a href="http://www.cushen.me">Academia</a> theme for the <a href="http://gohugo.io">Hugo</a>
-            engine.
+            {{ with .Site.Copyright }}{{ . | markdownify}} &middot; {{ end }}
 
-            <span class="pull-right"><a href="#top">Back to top</a></span>
+            Powered by the <a href="https://github.com/gcushen/hugo-academic" target="_blank">Academic theme</a> for <a href="http://gohugo.io" target="_blank">Hugo</a>.
+
+            <span class="pull-right"><a href="#top" id="back_to_top"><span class="button_icon"><i class="fa fa-chevron-up fa-2x" aria-hidden="true"></i></span></a></span>
 
         </p>
     </div>

+ 2 - 1
layouts/partials/header.html

@@ -15,8 +15,9 @@
     <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" />
+    <link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
 
-    <title>{{ .Site.Title }}</title>
+    <title>{{ if not .IsHome }}{{ .Title }} | {{ end }}{{ .Site.Title }}</title>
 
 </head>
 <body>

+ 4 - 4
layouts/_default/bio.html → layouts/partials/home_biography.html

@@ -12,8 +12,8 @@
             </div>
 
             <ul class="list-inline social-icon">
-                {{ range .Site.Params.contact.social }}
 
+                {{ range .Site.Params.social }}
                 <li>
                     <a href="{{ .link }}">
                     {{ if eq .icon_pack "ai" }}
@@ -32,14 +32,14 @@
 
     <div class="visible-sm visible-xs"></div>
 
-    <div class="col-xs-12 col-md-8" id="bio">
+    <div class="col-xs-12 col-md-8">
 
         {{ .Content }}
 
         <div class="row">
 
             <div class="col-md-5">
-                <h2>Interests</h2>
+                <h3>Interests</h3>
                 <ul>
                     {{ range .Site.Params.interests }}
                     <li>{{ . }}</li>
@@ -48,7 +48,7 @@
             </div>
 
             <div class="col-md-7">
-                <h2>Education</h2>
+                <h3>Education</h3>
                 <ul class="ul-edu fa-ul">
                     {{ range .Site.Params.education }}
                     <li>

+ 1 - 1
layouts/partials/contact.html → layouts/partials/home_contact.html

@@ -3,7 +3,7 @@
     {{ with .Site.Params.phone }}
     <li>
         <i class="fa fa-phone fa-fw" aria-hidden="true"></i>
-        <span>{{ . }}</span>
+        <span><a href="tel:{{ . }}">{{ . }}</a></span>
     </li>
     {{ end }}
 

+ 3 - 6
layouts/partials/navbar.html

@@ -1,3 +1,4 @@
+{{ $baseUrl := .Site.BaseURL }}
 <nav class="navbar navbar-default navbar-fixed-top" id="navbar-main">
     <div class="container">
 
@@ -9,23 +10,19 @@
                 <span class="icon-bar"></span>
                 <span class="icon-bar"></span>
             </button>
-            <a class="navbar-brand" href="/#">{{ .Site.Title }}</a>
+            <a class="navbar-brand" href="{{ $baseUrl }}">{{ .Site.Title }}</a>
         </div>
 
         <!-- Collect the nav links, forms, and other content for toggling -->
         <div class="collapse navbar-collapse" id="#navbar-collapse-1">
 
             <!-- Left Nav Bar -->
-            <ul class="nav navbar-nav">
+            <ul class="nav navbar-nav navbar-right">
                 {{ range .Site.Menus.main }}
                 <li class="nav-item"><a href="{{ .URL }}">{{ .Name }}</a></li>
                 {{ end }}
             </ul>
 
-            <!-- Right Nav Bar -->
-            <ul class="nav navbar-nav navbar-right">
-            </ul>
-
         </div><!-- /.navbar-collapse -->
     </div><!-- /.container -->
 </nav>

+ 8 - 0
layouts/partials/publication_list_buttons.html

@@ -0,0 +1,8 @@
+<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 }}
+{{ with .Params.url_dataset }}<a class="btn btn-primary btn-outline btn-xs" href="{{ . }}">Dataset</a>{{ end }}
+{{ with .Params.url_project }}<a class="btn btn-primary btn-outline btn-xs" href="{{ . }}">Project</a>{{ end }}
+{{ with .Params.url_slides }}<a class="btn btn-primary btn-outline btn-xs" href="{{ . }}">Slides</a>{{ end }}
+{{ with .Params.url_video }}<a class="btn btn-primary btn-outline btn-xs" href="{{ . }}">Video</a>{{ end }}
+{{ range .Params.url_custom }}<a class="btn btn-primary btn-outline btn-xs" href="{{ .url }}">{{ .name }}</a>{{ end }}

+ 20 - 0
layouts/partials/share.html

@@ -0,0 +1,20 @@
+{{ if not (isset .Site.Params "disable_sharing") }}
+<div class="share">
+
+    <a class="facebook" href="https://www.facebook.com/sharer.php?u={{ .Permalink | html }}" target="_blank">
+        <i class="fa fa-facebook-square"></i>
+        <span class="hidden">Facebook</span>
+    </a>
+
+    <a class="twitter" href="https://twitter.com/intent/tweet?text={{ .Title | html }}&amp;url={{ .Permalink | html }}" target="_blank">
+        <i class="fa fa-twitter-square"></i>
+        <span class="hidden">Twitter</span>
+    </a>
+
+    <a class="email" href="mailto:?subject={{ .Title | html }}&amp;body={{ .Permalink | html }}">
+        <i class="fa fa-envelope-square"></i>
+        <span class="hidden">Email</span>
+    </a>
+
+</div>
+{{ end }}

+ 0 - 0
layouts/projects/single.html → layouts/project/single.html


+ 14 - 9
layouts/publications/single.html → layouts/publication/single.html

@@ -5,11 +5,14 @@
     <div id="pub">
         <div class="pub-title">
             <h1>{{ .Title }}</h1>
-            <p class="citation_authors">
+            <span class="citation_authors">
                 {{ with .Params.authors }}
                 {{ delimit . ", " }}
                 {{ end }}
-            </p>
+            </span>
+            <span class="pull-right">
+                {{ partial "share.html" . }}
+            </span>
         </div>
 
         <h3>Abstract</h3>
@@ -39,18 +42,20 @@
         </div>
         <div class="visible-xs space-below"></div>
 
-        <div class="row">
+        <div class="row" style="padding-top: 10px">
             <div class="col-sm-1"></div>
             <div class="col-sm-10">
                 <div class="row">
-                    <div class="col-xs-12 col-sm-3" style="font-weight: bold">Links</div>
+                    <div class="col-xs-12 col-sm-3" style="font-weight: bold; line-height:34px;">Links</div>
                     <div class="col-xs-12 col-sm-9">
 
-                        {{ 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 }}
-                        {{ with .Params.url_dataset }}<a class="btn btn-primary btn-outline btn-xs" href="{{ . }}">Dataset</a>{{ end }}
-                        {{ with .Params.url_project }}<a class="btn btn-primary btn-outline btn-xs" href="{{ . }}">Project</a>{{ end }}
-                        {{ range .Params.url_custom }}<a class="btn btn-primary btn-outline btn-xs" href="{{ .url }}">{{ .name }}</a>{{ end }}
+                        {{ with .Params.url_pdf }}<a class="btn btn-primary btn-outline" href="{{ . }}">PDF</a>{{ end }}
+                        {{ with .Params.url_code }}<a class="btn btn-primary btn-outline" href="{{ . }}">Code</a>{{ end }}
+                        {{ with .Params.url_dataset }}<a class="btn btn-primary btn-outline" href="{{ . }}">Dataset</a>{{ end }}
+                        {{ with .Params.url_project }}<a class="btn btn-primary btn-outline" href="{{ . }}">Project</a>{{ end }}
+                        {{ with .Params.url_slides }}<a class="btn btn-primary btn-outline" href="{{ . }}">Slides</a>{{ end }}
+                        {{ with .Params.url_video }}<a class="btn btn-primary btn-outline" href="{{ . }}">Video</a>{{ end }}
+                        {{ range .Params.url_custom }}<a class="btn btn-primary btn-outline" href="{{ .url }}">{{ .name }}</a>{{ end }}
 
                     </div>
                 </div>

+ 0 - 0
layouts/section/projects.html → layouts/section/home.html


+ 0 - 0
layouts/section/blog.html → layouts/section/post.html


+ 0 - 0
layouts/section/project.html


+ 2 - 7
layouts/section/publications.html → layouts/section/publication.html

@@ -17,13 +17,8 @@
                     <ul class="compact fa-ul">
                         {{ range .Pages.ByDate.Reverse }}
                         <li>
-                            <i class="fa-li fa fa-file-text-o"  aria-hidden="true" style="color:#03396c;font-size:80%;padding-top:6px;"></i> {{ .Title | safeHTML }}
-                            <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 }}
-                            {{ with .Params.url_dataset }}<a class="btn btn-primary btn-outline btn-xs" href="{{ . }}">Dataset</a>{{ end }}
-                            {{ with .Params.url_project }}<a class="btn btn-primary btn-outline btn-xs" href="{{ . }}">Project</a>{{ end }}
-                            {{ range .Params.url_custom }}<a class="btn btn-primary btn-outline btn-xs" href="{{ .url }}">{{ .name }}</a>{{ end }}
+                            <i class="fa-li fa fa-file-text-o"  aria-hidden="true" style="color:#03396c;font-size:80%;padding-top:6px;"></i> {{ .Title | markdownify }}
+                            <p>{{ partial "publication_list_buttons" . }}</p>
                         </li>
                         {{ end }}
                     </ul>

+ 1 - 1
static/js/hugo-academic.js

@@ -18,7 +18,7 @@
       // Prevent default click behavior
       event.preventDefault();
 
-      var navbarHeight = $('.navbar-header').innerHeight;
+      var navbarHeight = $('.navbar-header').innerHeight();
 
       // Use jQuery's animate() method for smooth page scrolling.
       // The numerical parameter specifies the time (ms) taken to scroll to the specified hash.