Prechádzať zdrojové kódy

Add/modify `config.toml` settings to customize homepage language and recent publication/post counts. Refer to `exampleSite/config.toml` for changes.

George Cushen 9 rokov pred
rodič
commit
d03e66c7f9

+ 118 - 87
exampleSite/config.toml

@@ -12,106 +12,137 @@ googleAnalytics = ""
 
 
 [params]
-    name = "Lena Smith"
-    role = "Professor of Artificial Intelligence"
-    organization = "Stanford University"
+  name = "Lena Smith"
+  role = "Professor of Artificial Intelligence"
+  organization = "Stanford University"
+  email = "test@example.org"
+  address = "Stanford AI Lab, Stanford University, California, 90210, USA."
+  phone = "888 888 88 88"
+
+  # Date format (refer to Go's date format: http://flippinggodateformat.com )
+  #   Examples: "Mon, Jan 2, 2006" or "2006-01-02"
+  date_format = "Mon, Jan 2, 2006"
+
+  # Enable global LaTeX math rendering? If false, you can enable it locally on a per page basis.
+  math = false
+
+  # Link custom CSS and JS assets (relative to /static/css and /static/js respectively)
+  custom_css = []
+  custom_js  = []
+
+  # Biography section.
+  # Section will only be displayed if `content/home/about.md` exists.
+  [params.about]
     interests = ["Artificial Intelligence", "Computational Linguistics", "Information Retrieval"]
-    email = "test@example.org"
-    address = "Stanford AI Lab, Stanford University, California, 90210, USA."
-    phone = "888 888 88 88"
-
-    # Date format (refer to Go's date format: http://flippinggodateformat.com )
-    #   Examples: "Mon, Jan 2, 2006" or "2006-01-02"
-    date_format = "Mon, Jan 2, 2006"
-
-    # Enable global LaTeX math rendering? If false, you can enable it locally on a per page basis.
-    math = false
-
-    # Link custom CSS and JS assets (relative to /static/css and /static/js respectively)
-    custom_css = []
-    custom_js  = []
-
-    [[params.education]]
-        course = "PhD in Artificial Intelligence"
-        institution = "Stanford University"
-        year = 2012
-
-    [[params.education]]
-        course = "MEng in Artificial Intelligence"
-        institution = "Massachusetts Institute of Technology"
-        year = 2009
-
-    [[params.education]]
-        course = "BSc in Artificial Intelligence"
-        institution = "Massachusetts Institute of Technology"
-        year = 2008
-
-    [params.contact]
-        # Automatically link email and phone?
-        autolink = true
-
-    # Social/Academic Networking
-    #
-    # Icon pack "fa" includes the following social network icons:
-    #   twitter, weibo, linkedin, github, facebook, pinterest, google-plus, youtube, instagram, soundcloud
-    #   For email icon, use "fa" icon pack, "envelope" icon, and "mailto:your@email.com" as the link.
-    #   Full list: https://fortawesome.github.io/Font-Awesome/icons/
-    #
-    # Icon pack "ai" includes the following academic network icons:
-    #   google-scholar, arxiv, orcid, researchgate, mendeley
-    #   Full list: https://jpswalsh.github.io/academicons/
-
-    [[params.social]]
-        icon = "envelope"
-        icon_pack = "fa"
-        link = "mailto:test@example.org"
-
-    [[params.social]]
-        icon = "twitter"
-        icon_pack = "fa"
-        link = "//twitter.com/GeorgeCushen"
-
-    [[params.social]]
-        icon = "google-scholar"
-        icon_pack = "ai"
-        link = "https://scholar.google.co.uk/citations?user=sIwtMXoAAAAJ"
-
-    [[params.social]]
-        icon = "github"
-        icon_pack = "fa"
-        link = "//github.com/gcushen"
+    str_interests = "Interests"
+    str_education = "Education"
+
+    [[params.about.education]]
+      course = "PhD in Artificial Intelligence"
+      institution = "Stanford University"
+      year = 2012
+
+    [[params.about.education]]
+      course = "MEng in Artificial Intelligence"
+      institution = "Massachusetts Institute of Technology"
+      year = 2009
+
+    [[params.about.education]]
+      course = "BSc in Artificial Intelligence"
+      institution = "Massachusetts Institute of Technology"
+      year = 2008
+
+  # Publications section.
+  # Section will only be displayed if there are publications in `content/publication/`.
+  [params.publications]
+    count = 10
+    title = "Recent Publications"
+    subtitle = ""
+    str_all = "More Publications"
+
+  # Posts section.
+  # Section will only be displayed if there are posts in `content/post/`.
+  [params.posts]
+    count = 5
+    title = "Recent Posts"
+    subtitle = ""
+    str_all = "More Posts"
+    str_read_more = "Read more"
+
+  # Projects section.
+  # Section will only be displayed if there are projects in `content/project/`.
+  [params.projects]
+    title = "Projects"
+    subtitle = ""
+
+  # Contact section.
+  [params.contact]
+    enable = true
+    title = "Contact"
+    subtitle = ""
+    autolink = true  # Automatically link email and phone?
+
+  # Social/Academic Networking
+  #
+  # Icon pack "fa" includes the following social network icons:
+  #   twitter, weibo, linkedin, github, facebook, pinterest, google-plus, youtube, instagram, soundcloud
+  #   For email icon, use "fa" icon pack, "envelope" icon, and "mailto:your@email.com" as the link.
+  #   Full list: https://fortawesome.github.io/Font-Awesome/icons/
+  #
+  # Icon pack "ai" includes the following academic network icons:
+  #   google-scholar, arxiv, orcid, researchgate, mendeley
+  #   Full list: https://jpswalsh.github.io/academicons/
+
+  [[params.social]]
+    icon = "envelope"
+    icon_pack = "fa"
+    link = "mailto:test@example.org"
+
+  [[params.social]]
+    icon = "twitter"
+    icon_pack = "fa"
+    link = "//twitter.com/GeorgeCushen"
+
+  [[params.social]]
+    icon = "google-scholar"
+    icon_pack = "ai"
+    link = "https://scholar.google.co.uk/citations?user=sIwtMXoAAAAJ"
+
+  [[params.social]]
+    icon = "github"
+    icon_pack = "fa"
+    link = "//github.com/gcushen"
 
 
 # Navigation Links
-#
-# The weight parameter defines the order that the links will appear in.
+#   The weight parameter defines the order that the links will appear in.
 
 [[menu.main]]
-    name = "Home"
-    url = "#top"
-    weight = 1
+  name = "Home"
+  url = "#top"
+  weight = 1
 
 [[menu.main]]
-    name = "Publications"
-    url = "#publications"
-    weight = 2
+  name = "Publications"
+  url = "#publications"
+  weight = 2
 
 [[menu.main]]
-    name = "Posts"
-    url = "#posts"
-    weight = 3
+  name = "Posts"
+  url = "#posts"
+  weight = 3
 
 [[menu.main]]
-    name = "Projects"
-    url = "#projects"
-    weight = 4
+  name = "Projects"
+  url = "#projects"
+  weight = 4
 
 [[menu.main]]
-    name = "Teaching"
-    url = "#teaching"
-    weight = 5
+  name = "Teaching"
+  url = "#teaching"
+  weight = 5
 
 [[menu.main]]
-    name = "Contact"
-    url = "#contact"
-    weight = 6
+  name = "Contact"
+  url = "#contact"
+  weight = 6

+ 37 - 15
layouts/index.html

@@ -22,13 +22,21 @@
 <section id="publications" class="home-section">
     <div class="container">
         <div class="row">
-            <div class="col-xs-12 col-md-4">
-                <h1>Recent Publications</h1>
-                <p><a href="{{ .Site.BaseURL }}publication/">More Publications <i class="fa fa-angle-double-right" style="padding-left: 5px;"></i></a></p>
+            <div class="col-xs-12 col-md-4 section-heading">
+                <h1>{{ with .Site.Params.publications.title }}{{ . | markdownify }}{{ end }}</h1>
+                {{ with .Site.Params.publications.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
+                {{ if gt $pubs_len .Site.Params.publications.count }}
+                <p class="view-all">
+                    <a href="{{ .Site.BaseURL }}publication/">
+                        {{ with .Site.Params.publications.str_all }}{{ . | markdownify }}{{ end }}
+                        <i class="fa fa-angle-double-right"></i>
+                    </a>
+                </p>
+                {{ end }}
             </div>
             <div class="col-xs-12 col-md-8">
                 <ul class="fa-ul">
-                    {{ range $index, $page := first 10 (where .Data.Pages "Type" "publication") }}
+                    {{ range $index, $page := first .Site.Params.publications.count (where .Data.Pages "Type" "publication") }}
                     <li itemscope itemtype="http://schema.org/CreativeWork">
                         <i class="fa-li fa fa-file-text-o pub-icon" aria-hidden="true"></i>
                         <span itemprop="name">{{ .Title }}</span>
@@ -49,12 +57,20 @@
 <section id="posts" class="home-section">
     <div class="container">
         <div class="row">
-            <div class="col-xs-12 col-md-4">
-                <h1>Posts</h1>
-                <p><a href="{{ .Site.BaseURL }}post/">More Posts <i class="fa fa-angle-double-right" style="padding-left: 5px;"></i></a></p>
+            <div class="col-xs-12 col-md-4 section-heading">
+                <h1>{{ with .Site.Params.posts.title }}{{ . | markdownify }}{{ end }}</h1>
+                {{ with .Site.Params.posts.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
+                {{ if gt $posts_len .Site.Params.posts.count }}
+                <p class="view-all">
+                    <a href="{{ .Site.BaseURL }}post/">
+                        {{ with .Site.Params.posts.str_all }}{{ . | markdownify }}{{ end }}
+                        <i class="fa fa-angle-double-right"></i>
+                    </a>
+                </p>
+                {{ end }}
             </div>
             <div class="col-xs-12 col-md-8">
-                {{ range first 5 (where .Data.Pages "Type" "post") }}
+                {{ range first .Site.Params.posts.count (where .Data.Pages "Type" "post") }}
                 <div class="article-list-item" itemscope="" itemprop="blogPost">
                     <h3 class="post-title" itemprop="name"><a href="{{ .Permalink }}" itemprop="url">{{ .Title }}</a></h3>
                     {{ partial "article_metadata" (dict "content" . "is_list" 1) }}
@@ -66,7 +82,9 @@
                         {{ end }}
                     </p>
                     <p class="read-more">
-                        <a href="{{ .Permalink }}" class="btn btn-primary btn-outline">Read more</a>
+                        <a href="{{ .Permalink }}" class="btn btn-primary btn-outline">
+                            {{ with .Site.Params.posts.str_read_more }}{{ . | markdownify }}{{ end }}
+                        </a>
                     </p>
                 </div>
                 {{ end }}
@@ -83,8 +101,9 @@
 <section id="projects" class="home-section">
     <div class="container">
         <div class="row">
-            <div class="col-xs-12 col-md-4">
-                <h1>Projects</h1>
+            <div class="col-xs-12 col-md-4 section-heading">
+                <h1>{{ with .Site.Params.projects.title }}{{ . | markdownify }}{{ end }}</h1>
+                {{ with .Site.Params.projects.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
             </div>
             <div class="col-xs-12 col-md-8">
                 <ul class="fa-ul">
@@ -127,8 +146,9 @@
 <section id="{{ range $k, $v := $title_words }}{{ if eq $k 0 }}{{ . | urlize | lower }}{{ end }}{{ end }}" class="home-section">
     <div class="container">
         <div class="row">
-            <div class="col-xs-12 col-md-4">
+            <div class="col-xs-12 col-md-4 section-heading">
                 <h1>{{ title $page.Title }}</h1>
+                {{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
             </div>
             <div class="col-xs-12 col-md-8">
                 {{ $page.Content }}
@@ -141,11 +161,13 @@
 
 
 <!-- Contact Section -->
+{{ if .Site.Params.contact.enable }}
 <section id="contact" class="home-section">
     <div class="container">
         <div class="row">
-            <div class="col-xs-12 col-md-4">
-                <h1>Contact</h1>
+            <div class="col-xs-12 col-md-4 section-heading">
+                <h1>{{ with .Site.Params.contact.title }}{{ . | markdownify }}{{ end }}</h1>
+                {{ with .Site.Params.contact.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
             </div>
             <div class="col-xs-12 col-md-8">
                 {{ partial "home_contact.html" . }}
@@ -153,7 +175,7 @@
         </div>
     </div>
 </section>
-
+{{ end }}
 
 <!-- Page Footer -->
 {{ partial "footer_container.html" . }}

+ 7 - 7
layouts/partials/home_biography.html

@@ -7,7 +7,7 @@
             <div class="portrait-title">
                 <h2 itemprop="name">{{ .Site.Params.name }}</h2>
                 <h3 itemprop="jobTitle">{{ .Site.Params.role }}</h3>
-                <h3 itemprop="worksFor">{{ .Site.Params.organization }}</h3>
+                {{ with .Site.Params.organization }}<h3 itemprop="worksFor">{{ . }}</h3>{{ end }}
             </div>
 
             <ul class="social-icon">
@@ -35,22 +35,22 @@
 
         <div class="row">
 
-            {{ if isset .Site.Params "interests" }}
+            {{ if isset .Site.Params.about "interests" }}
             <div class="col-md-5">
-                <h3>Interests</h3>
+                <h3>{{ with .Site.Params.about.str_interests }}{{ . | markdownify }}{{ end }}</h3>
                 <ul>
-                    {{ range .Site.Params.interests }}
+                    {{ range .Site.Params.about.interests }}
                     <li>{{ . }}</li>
                     {{ end }}
                 </ul>
             </div>
             {{ end }}
 
-            {{ if isset .Site.Params "education" }}
+            {{ if isset .Site.Params.about "education" }}
             <div class="col-md-7">
-                <h3>Education</h3>
+                <h3>{{ with .Site.Params.about.str_education }}{{ . | markdownify }}{{ end }}</h3>
                 <ul class="ul-edu fa-ul">
-                    {{ range .Site.Params.education }}
+                    {{ range .Site.Params.about.education }}
                     <li>
                         <i class="fa-li fa fa-graduation-cap"></i>
                         <div class="description">

+ 11 - 0
static/css/hugo-academic.css

@@ -160,6 +160,17 @@ pre {
     background-color: rgb(247, 247, 247);
 }
 
+.section-heading h1 {
+    margin: 0 0 10px 0;
+}
+
+.section-heading p {
+    font-family: 'Lato', sans-serif;
+    font-weight: 400;
+    font-size: 1.1rem;
+    color: #b2b2b2;
+}
+
 /*************************************************
  *  Biography
  **************************************************/