Browse Source

Merge https://github.com/gcushen/hugo-academic

Xi Ruoyao 6 years ago
parent
commit
fca0788170

+ 12 - 0
.github/FUNDING.yml

@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: cushen
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: https://paypal.me/cushen

+ 14 - 12
README.md

@@ -8,17 +8,19 @@
 
 [Check out the latest **demo**](https://academic-demo.netlify.com/) of what you'll get in less than 10 minutes, or [view the **showcase**](https://sourcethemes.com/academic/#expo) of personal, project, and business sites.
 
-- [**Setup Academic**](#install)
-- [**Get Started**](https://sourcethemes.com/academic/docs/get-started/)
-- [View the documentation](https://sourcethemes.com/academic/docs/)
-- [Ask a question](http://discuss.gohugo.io/)
-- [Request a feature or report a bug](https://github.com/gcushen/hugo-academic/issues)
-- Updating? View the [Update Guide](https://sourcethemes.com/academic/docs/update/) and [Release Notes](https://sourcethemes.com/academic/updates/)
-- Support development of Academic:
-  - [Donate a coffee](https://paypal.me/cushen)
-  - [Become a backer on Patreon](https://www.patreon.com/cushen)
-  - [Decorate your laptop or journal with an Academic sticker](https://www.redbubble.com/people/neutreno/works/34387919-academic)
-  - [Wear the T-shirt](https://academic.threadless.com/)
+- 👉 [**Get Started**](https://sourcethemes.com/academic/docs/install/)
+- 📚 [View the **documentation**](https://sourcethemes.com/academic/docs/)
+- 💬 [**Ask a question** on the forum](https://discourse.gohugo.io)
+- 👥 [Chat with the **community**](https://spectrum.chat/academic)
+- 🐦 Twitter: [@source_themes](https://twitter.com/source_themes) [@GeorgeCushen](https://twitter.com/GeorgeCushen) [#MadeWithAcademic](https://twitter.com/search?q=%23MadeWithAcademic&src=typd)
+- 💡 [Request a **feature** or report a **bug**](https://github.com/gcushen/hugo-academic/issues)
+- ⬆️ **Updating?** View the [Update Guide](https://sourcethemes.com/academic/docs/update/) and [Release Notes](https://sourcethemes.com/academic/updates/)
+- :heart: **Support development** of Academic:
+  - ☕️ [**Donate a coffee**](https://paypal.me/cushen)
+  - 💵 [Become a backer on **Patreon**](https://www.patreon.com/cushen)
+  - 🖼️ [Decorate your laptop or journal with an Academic **sticker**](https://www.redbubble.com/people/neutreno/works/34387919-academic)
+  - 👕 [Wear the **T-shirt**](https://academic.threadless.com/)
+  - :woman_technologist: [**Contribute**](https://sourcethemes.com/academic/docs/contribute/)
 
 [![Screenshot](https://raw.githubusercontent.com/gcushen/hugo-academic/master/academic.png)](https://github.com/gcushen/hugo-academic/)
 
@@ -135,7 +137,7 @@ cp -av themes/academic/exampleSite/* .
 
 [View the Update Guide](https://sourcethemes.com/academic/docs/update/).
 
-Feel free to *star* the project on [Github](https://github.com/gcushen/hugo-academic/) to help keep track of [updates](https://sourcethemes.com/academic/updates).
+Feel free to *star* the project on [Github](https://github.com/gcushen/hugo-academic/) and follow [@source_themes](https://twitter.com/source_themes) on Twitter to help keep track of [updates](https://sourcethemes.com/academic/updates).
 
 ## License
 

+ 8 - 0
assets/js/academic.js

@@ -49,6 +49,13 @@
     }
   }
 
+  function removeQueryParamsFromUrl() {
+    if (window.history.pushState) {
+      let urlWithoutSearchParams = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.hash;
+      window.history.pushState({path:urlWithoutSearchParams}, '', urlWithoutSearchParams);
+    }
+  }
+
   // Check for hash change event and fix responsive offset for hash links (e.g. Markdown footnotes).
   window.addEventListener("hashchange", scrollToAnchor);
 
@@ -295,6 +302,7 @@
     if ($('body').hasClass('searching')) {
       $('[id=search-query]').blur();
       $('body').removeClass('searching');
+      removeQueryParamsFromUrl();
     } else {
       $('body').addClass('searching');
       $('.search-results').css({opacity: 0, visibility: 'visible'}).animate({opacity: 1}, 200);

+ 0 - 1
assets/sass/academic/_nav.scss

@@ -36,7 +36,6 @@ nav#navbar-main li.nav-item {
   -webkit-transition: 0.2s ease;
   transition: 0.2s ease;
   color: $sta-menu-text;
-  font-weight: 600;
 }
 
 .navbar-light .navbar-nav>.nav-item>.nav-link:focus {

+ 2 - 1
assets/sass/academic/_root.scss

@@ -278,9 +278,10 @@ small,
 
 a[data-fancybox] {
   text-decoration: none;
+  cursor: zoom-in;
 }
 
-a[data-fancybox] img {
+.gallery a[data-fancybox] img {
   height: 250px;
   max-width: inherit;
   display: inherit;

+ 10 - 0
assets/sass/bootstrap_variables.scss

@@ -1,3 +1,13 @@
 /* Set Bootstrap variables */
+
+// Set colors.
 $primary: $sta-primary;
 $text-muted: rgba(0,0,0,0.54);
+
+// Container widths - override XL default of `1140px`.
+$container-max-widths: (
+  sm: 540px,
+  md: 720px,
+  lg: 960px,
+  xl: 1200px
+);

+ 0 - 15
data/fonts/playfair.toml

@@ -1,15 +0,0 @@
-# Font style metadata
-name = "Playfair"
-
-# Optional Google font URL
-google_fonts = "Playfair+Display:400,700|Fauna+One"
-
-# Font families
-heading_font = "Playfair Display"
-body_font = "Fauna One"
-nav_font = "Fauna One"
-mono_font = "Roboto Mono"
-
-# Font size
-font_size = "20"
-font_size_small = "16"

+ 15 - 0
data/fonts/rose.toml

@@ -0,0 +1,15 @@
+# Font style metadata
+name = "Rose"
+
+# Optional Google font URL
+google_fonts = "Cutive+Mono|Lora:400,700|Roboto:400,700"
+
+# Font families
+heading_font = "Lora"
+body_font = "Roboto"
+nav_font = "Lora"
+mono_font = "Cutive Mono"
+
+# Font size
+font_size = "20"
+font_size_small = "16"

+ 0 - 18
data/themes/cupcake.toml

@@ -1,18 +0,0 @@
-# Theme metadata
-name = "Cupcake"
-
-# Is theme light or dark?
-light = true
-
-# Primary
-primary = "#EC407A"
-
-# Menu
-menu_primary = "#BE37C7"
-menu_text = "#FFB298"
-menu_text_active = "#fff"
-menu_title = "#FFB298"
-
-# Home sections
-home_section_odd = "#FFB298"
-home_section_even = "#FFB298"

+ 18 - 0
data/themes/rose.toml

@@ -0,0 +1,18 @@
+# Theme metadata
+name = "Rose"
+
+# Is theme light or dark?
+light = true
+
+# Primary
+primary = "rgb(251, 191, 183)"
+
+# Menu
+menu_primary = "rgb(247, 247, 247)"
+menu_text = "#000"
+menu_text_active = "rgb(25, 25, 25)"
+menu_title = "#000"
+
+# Home sections
+home_section_odd = "#FFF"
+home_section_even = "rgb(234, 242, 250)"

+ 1 - 1
layouts/partials/page_links.html

@@ -29,7 +29,7 @@
   {{ i18n "btn_pdf" }}
 </a>
 {{ end }}
-{{ $resource := $page.Resources.GetMatch "*.bib" }}
+{{ $resource := $page.Resources.GetMatch "cite.bib" }}
 {{ with $resource }}
 <button type="button" class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}} js-cite-modal"
         data-filename="{{ .RelPermalink }}">

+ 1 - 1
layouts/partials/page_links_div.html

@@ -10,7 +10,7 @@
   {{ $pdf_link = true }}
 {{ end }}
 
-{{ $resource := $page.Resources.GetMatch "*.bib" }}
+{{ $resource := $page.Resources.GetMatch "cite.bib" }}
 {{ with $resource }}
   {{ $cite_link = true }}
 {{ end }}

+ 5 - 2
layouts/partials/site_head.html

@@ -96,7 +96,7 @@
 
   {{/* We cannot use SRI with Google Fonts because the CSS is dynamically generated according to the user agent. */}}
   {{ with ($scr.Get "google_fonts") }}
-  <link rel="stylesheet" {{ printf "href=\"//fonts.googleapis.com/css?family=%s\"" . | safeHTMLAttr }}>
+  <link rel="stylesheet" {{ printf "href=\"https://fonts.googleapis.com/css?family=%s&display=swap\"" . | safeHTMLAttr }}>
   {{ end }}
 
   {{ $css_options := (dict "targetPath" "css/academic.css" "outputStyle" "compressed") }}
@@ -170,7 +170,10 @@
   <meta property="og:url" content="{{ .Permalink }}">
   <meta property="og:title" content="{{ if not .IsHome }}{{ .Title }} | {{ end }}{{ site.Title }}">
   <meta property="og:description" content="{{ $desc }}">
-  {{- with $og_image }}<meta property="og:image" content="{{ . }}">{{end}}
+  {{- with $og_image -}}
+  <meta property="og:image" content="{{.}}">
+  <meta property="twitter:image" content="{{.}}">
+  {{- end -}}
   <meta property="og:locale" content="{{ site.LanguageCode | default "en-us" }}">
   {{ if .IsPage }}
   {{ if not .PublishDate.IsZero }}<meta property="article:published_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}">

+ 11 - 4
layouts/shortcodes/figure.html

@@ -3,10 +3,17 @@
 {{ if .Get "library" }}
   {{ $image_src = printf "img/%s" $image_src | relURL }}
 {{ end }}
+{{ $lightbox := eq (.Get "lightbox" | default "false") "true" }}
+{{ $group := .Get "lightbox-group" | default "" }}
+
 <figure{{ with .Get "class" }} class="{{.}}"{{ end }}>
-{{ if .Get "link"}}<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>{{ end }}
-<img src="{{ $image_src }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}{{ with .Get "height" }}height="{{.}}" {{ end }}/>
-{{ if .Get "link"}}</a>{{ end }}
+{{ if $lightbox }}
+  <a data-fancybox="{{$group}}" href="{{$image_src}}" {{ with .Get "caption"}}data-caption="{{ .|markdownify|emojify }}"{{ end }}>
+{{ else if .Get "link"}}
+  <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{.}}"{{ end }}{{ with .Get "rel" }} rel="{{.}}"{{ end }}>
+{{ end }}
+<img src="{{$image_src}}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}{{ with .Get "height" }}height="{{.}}" {{ end }}>
+{{ if or $lightbox (.Get "link") }}</a>{{ end }}
 {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
 {{ $figure := split (i18n "figure" | default "Figure %d:") "%d" }}
 <figcaption data-pre="{{ index $figure 0 }}" data-post="{{ index $figure 1 }}" {{ if eq (.Get "numbered") "true" }}class="numbered"{{ end }}>
@@ -19,4 +26,4 @@
   </p> {{ end }}
 </figcaption>
 {{ end }}
-</figure>
+</figure>