mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 19:15:16 +02:00
Set widget identifiers to their respective filenames
Example: `content/home/about.md` widget is now linked from the menu bar by setting the relevant URL as "#about" in `config.toml`.
This commit is contained in:
parent
f3e9dea37f
commit
8277658b81
9 changed files with 265 additions and 312 deletions
|
@ -82,16 +82,18 @@ googleAnalytics = ""
|
|||
|
||||
|
||||
# Navigation Links
|
||||
# To link a homepage widget, specify the URL as a hash `#` followed by the filename of the
|
||||
# desired widget in your `content/home/` folder.
|
||||
# The weight parameter defines the order that the links will appear in.
|
||||
|
||||
[[menu.main]]
|
||||
name = "Home"
|
||||
url = "#bio"
|
||||
url = "#about"
|
||||
weight = 1
|
||||
|
||||
[[menu.main]]
|
||||
name = "Publications"
|
||||
url = "#publications"
|
||||
url = "#publications_selected"
|
||||
weight = 2
|
||||
|
||||
[[menu.main]]
|
||||
|
|
|
@ -5,11 +5,14 @@
|
|||
<span id="homepage" style="display: none"></span>
|
||||
|
||||
<!-- Widgets -->
|
||||
{{ $pubs_selected_len := len (where (where .Data.Pages "Type" "publication") ".Params.selected" true) }}
|
||||
{{ range $index, $page := where .Data.Pages "Type" "home" }}
|
||||
{{ $params := dict "root" $ "page" $page "pubs_selected_len" $pubs_selected_len }}
|
||||
{{ $params := dict "root" $ "page" $page }}
|
||||
{{ $widget := printf "widgets/%s.html" ( or $page.Params.widget "custom" ) }}
|
||||
<section id="{{ $page.File.BaseFileName }}" class="home-section">
|
||||
<div class="container">
|
||||
{{ partial $widget $params }}
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
<!-- Page Footer -->
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
|
||||
<!-- About/Biography widget -->
|
||||
<section id="bio" class="home-section">
|
||||
<div class="container">
|
||||
|
||||
<div class="row" itemprop="author" itemscope itemtype="http://schema.org/Person">
|
||||
<!-- About widget -->
|
||||
<div class="row" itemprop="author" itemscope itemtype="http://schema.org/Person">
|
||||
<div class="col-xs-12 col-md-4">
|
||||
<div id="profile">
|
||||
|
||||
|
@ -34,9 +31,6 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="visible-sm visible-xs"></div>
|
||||
|
||||
<div class="col-xs-12 col-md-8" itemprop="description">
|
||||
|
||||
{{ $page.Content }}
|
||||
|
@ -72,9 +66,5 @@
|
|||
{{ end }}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
{{ $autolink := default true $page.Params.autolink }}
|
||||
|
||||
<!-- Contact widget -->
|
||||
<section id="contact" class="home-section">
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-4 section-heading">
|
||||
<h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
|
||||
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
|
||||
|
@ -53,7 +50,4 @@
|
|||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
{{ $page := .page }}
|
||||
{{ $title_words := split $page.Title " " }}
|
||||
|
||||
<!-- Custom widget -->
|
||||
<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="row">
|
||||
<div class="col-xs-12 col-md-4 section-heading">
|
||||
<h1>{{ title $page.Title }}</h1>
|
||||
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
|
||||
|
@ -14,6 +9,4 @@
|
|||
<div class="col-xs-12 col-md-8">
|
||||
{{ $page.Content }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
|
||||
{{ $posts_len := len (where (where $.Data.Pages "Type" "post") ".Params.notonhomepage" nil) }}
|
||||
{{ if gt $posts_len 0 }}
|
||||
<!-- Blog Posts widget -->
|
||||
<section id="posts" class="home-section">
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<!-- Blog Posts widget -->
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-4 section-heading">
|
||||
|
||||
<h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
|
||||
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
|
||||
{{ if gt $posts_len $page.Params.count }}
|
||||
|
@ -19,8 +16,10 @@
|
|||
</a>
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-8">
|
||||
|
||||
{{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
|
||||
|
||||
{{ if $page.Params.tags }}
|
||||
|
@ -36,7 +35,4 @@
|
|||
{{ end }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
|
||||
{{ $projects_len := len (where $.Data.Pages "Type" "project") }}
|
||||
{{ if gt $projects_len 0 }}
|
||||
<!-- Projects widget -->
|
||||
<section id="projects" class="home-section">
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-4 section-heading">
|
||||
<h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
|
||||
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
|
||||
|
@ -82,8 +77,4 @@
|
|||
{{ end }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
{{ $pubs_selected_len := .pubs_selected_len }}
|
||||
|
||||
{{ $pubs_len := len (where $.Data.Pages "Type" "publication") }}
|
||||
{{ if gt $pubs_len 0 }}
|
||||
<!-- Publications widget -->
|
||||
<section {{ if eq $pubs_selected_len 0 }}id="publications" {{ end }}class="home-section">
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<!-- Publications widget -->
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-4 section-heading">
|
||||
<h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
|
||||
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
|
||||
|
@ -35,9 +30,6 @@
|
|||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
{{ $ := .root }}
|
||||
{{ $page := .page }}
|
||||
{{ $pubs_selected_len := .pubs_selected_len }}
|
||||
|
||||
{{ if gt $pubs_selected_len 0 }}
|
||||
<!-- Selected Publications widget -->
|
||||
<section id="publications" class="home-section">
|
||||
<div class="container">
|
||||
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-4 section-heading">
|
||||
<h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
|
||||
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
|
||||
|
@ -26,9 +21,6 @@
|
|||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue