Browse Source

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

Xℹ Ruoyao 4 years ago
parent
commit
e56784a219

+ 7 - 1
.github/ISSUE_TEMPLATE/config.yml

@@ -1,5 +1,11 @@
 blank_issues_enabled: false
 contact_links:
+  - name: Troubleshooting Guide
+    url: https://wowchemy.com/docs/faq/
+    about: Solve common issues fast.
   - name: Questions and Discussions
-    url: https://spectrum.chat/academic/
+    url: https://github.com/wowchemy/wowchemy-hugo-modules/discussions
     about: Please ask and answer questions here.
+  - name: Chat with the Community
+    url: https://discord.gg/z8wNYzb
+    about: Join the Wowchemy Community on Discord.

+ 2 - 2
.github/contributing.md

@@ -1,6 +1,6 @@
-# Contributing to Academic
+# Contributing to Wowchemy
 
-For **help**, **support**, and **questions** please use our **[community chat](https://spectrum.chat/academic)**  🚑.
+For **help**, **support**, and **questions** please use our **[community chat](https://discord.gg/z8wNYzb)**  🚑.
 
 ---
 

+ 31 - 0
.github/workflows/build-test-site.yaml

@@ -0,0 +1,31 @@
+name: build test site
+
+on:
+  push:
+    branches:
+      - master
+    paths:
+      - 'wowchemy/**'
+  pull_request:
+    branches:
+      - master
+    paths:
+      - 'wowchemy/**'
+
+jobs:
+  deploy:
+    runs-on: ubuntu-18.04
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          submodules: true  # Fetch any Git submodules (true OR recursive)
+          fetch-depth: 0    # Fetch all history for .GitInfo and .Lastmod
+
+      - name: Setup Hugo
+        uses: peaceiris/actions-hugo@v2
+        with:
+          hugo-version: 'latest'
+          extended: true
+
+      - name: Build
+        run: hugo --minify

+ 1 - 0
netlify-cms-academic/static/admin/index.html

@@ -1,6 +1,7 @@
 <!doctype html>
 <html lang="en-us">
 <head>
+  <meta name="robots" content="noindex">
   <meta charset="utf-8">
   <meta content="width=device-width, initial-scale=1.0" name="viewport">
   <title>Wowchemy Content Manager</title>

+ 53 - 46
wowchemy/assets/js/wowchemy.js

@@ -125,27 +125,57 @@
   // Publication container.
   let $grid_pubs = $('#container-publications');
 
-  // Initialise Isotope.
-  $grid_pubs.isotope({
-    itemSelector: '.isotope-item',
-    percentPosition: true,
-    masonry: {
-      // Use Bootstrap compatible grid layout.
-      columnWidth: '.grid-sizer'
-    },
-    filter: function () {
+  // Initialise Isotope publication layout if required.
+  if ($grid_pubs.length)
+  {
+    $grid_pubs.isotope({
+      itemSelector: '.isotope-item',
+      percentPosition: true,
+      masonry: {
+        // Use Bootstrap compatible grid layout.
+        columnWidth: '.grid-sizer'
+      },
+      filter: function () {
+        let $this = $(this);
+        let searchResults = searchRegex ? $this.text().match(searchRegex) : true;
+        let filterResults = filterValues ? $this.is(filterValues) : true;
+        return searchResults && filterResults;
+      }
+    });
+
+    // Filter by search term.
+    let $quickSearch = $('.filter-search').keyup(debounce(function () {
+      searchRegex = new RegExp($quickSearch.val(), 'gi');
+      $grid_pubs.isotope();
+    }));
+
+    $('.pub-filters').on('change', function () {
       let $this = $(this);
-      let searchResults = searchRegex ? $this.text().match(searchRegex) : true;
-      let filterResults = filterValues ? $this.is(filterValues) : true;
-      return searchResults && filterResults;
-    }
-  });
 
-  // Filter by search term.
-  let $quickSearch = $('.filter-search').keyup(debounce(function () {
-    searchRegex = new RegExp($quickSearch.val(), 'gi');
-    $grid_pubs.isotope();
-  }));
+      // Get group key.
+      let filterGroup = $this[0].getAttribute('data-filter-group');
+
+      // Set filter for group.
+      pubFilters[filterGroup] = this.value;
+
+      // Combine filters.
+      filterValues = concatValues(pubFilters);
+
+      // Activate filters.
+      $grid_pubs.isotope();
+
+      // If filtering by publication type, update the URL hash to enable direct linking to results.
+      if (filterGroup === "pubtype") {
+        // Set hash URL to current filter.
+        let url = $(this).val();
+        if (url.substr(0, 9) === '.pubtype-') {
+          window.location.hash = url.substr(9);
+        } else {
+          window.location.hash = '';
+        }
+      }
+    });
+  }
 
   // Debounce input to prevent spamming filter requests.
   function debounce(fn, threshold) {
@@ -173,35 +203,12 @@
     return value;
   }
 
-  $('.pub-filters').on('change', function () {
-    let $this = $(this);
-
-    // Get group key.
-    let filterGroup = $this[0].getAttribute('data-filter-group');
-
-    // Set filter for group.
-    pubFilters[filterGroup] = this.value;
-
-    // Combine filters.
-    filterValues = concatValues(pubFilters);
-
-    // Activate filters.
-    $grid_pubs.isotope();
-
-    // If filtering by publication type, update the URL hash to enable direct linking to results.
-    if (filterGroup == "pubtype") {
-      // Set hash URL to current filter.
-      let url = $(this).val();
-      if (url.substr(0, 9) == '.pubtype-') {
-        window.location.hash = url.substr(9);
-      } else {
-        window.location.hash = '';
-      }
-    }
-  });
-
   // Filter publications according to hash in URL.
   function filter_publications() {
+    // Check for Isotope publication layout.
+    if (!$grid_pubs.length)
+      return
+
     let urlHash = window.location.hash.replace('#', '');
     let filterValue = '*';
 

+ 0 - 5
wowchemy/config.toml

@@ -1,5 +0,0 @@
-[module]
-  [module.hugoVersion]
-    # This version of Wowchemy is compatible with the following Hugo versions:
-    min = "0.73.0"
-    extended = true

+ 15 - 0
wowchemy/config.yaml

@@ -0,0 +1,15 @@
+mediaTypes:
+  application/manifest+json:
+    suffixes:
+      - webmanifest
+outputFormats:
+  WebAppManifest:
+    mediaType: application/manifest+json
+    rel: manifest
+module:
+  hugoVersion:
+    min: '0.73.0'
+    extended: true
+params:
+  theme: minimal
+  font: native

+ 1 - 0
wowchemy/data/i18n/languages.yaml

@@ -19,6 +19,7 @@
 "ko": "한국어"
 "lt": "Lietuvių"
 "lv": "Latviešu"
+"nb": "Norsk bokmål"
 "nl": "Nederlands"
 "pl": "Polski"
 "pt": "Português"

+ 1 - 1
wowchemy/data/wowchemy.toml

@@ -1,3 +1,3 @@
 # Wowchemy
 
-version = "4.8.0"
+version = "5.0.0-beta.0"

+ 239 - 0
wowchemy/i18n/nb.yaml

@@ -0,0 +1,239 @@
+# Navigation
+
+- id: toggle_navigation
+  translation: Bytte navigering
+
+- id: table_of_contents
+  translation: Innholdsfortegnelse
+
+- id: on_this_page
+  translation: Innhold
+
+- id: back_to_top
+  translation: Tilbake til toppen
+
+# General
+
+- id: related
+  translation: Relatert
+
+- id: minute_read
+  translation: min. lesing
+
+- id: previous
+  translation: Forrige
+
+- id: next
+  translation: Neste
+
+- id: figure
+  translation: "Figur %d:"
+
+- id: edit_page
+  translation: Rediger denne siden
+
+# Themes
+
+- id: theme_light
+  translation: Lys
+
+- id: theme_dark
+  translation: Mørk
+
+- id: theme_auto
+  translation: Automatisk
+
+# Buttons
+
+- id: btn_preprint
+  translation: Opprinnelig manus (preprint)
+
+- id: btn_pdf
+  translation: PDF
+
+- id: btn_cite
+  translation: Sitere
+
+- id: btn_slides
+  translation: Presentasjoner
+
+- id: btn_video
+  translation: Video
+
+- id: btn_code
+  translation: Kode
+
+- id: btn_dataset
+  translation: Datasett
+
+- id: btn_project
+  translation: Prosjekt
+
+- id: btn_poster
+  translation: Innlegg
+
+- id: btn_source
+  translation: Kildedokument
+
+- id: btn_copy
+  translation: Kopi
+
+- id: btn_download
+  translation: Last ned
+
+# About widget
+
+- id: interests
+  translation: Interesser
+
+- id: education
+  translation: Utdanning
+
+- id: user_profile_latest
+  translation: Siste
+
+# Accomplishments widget
+
+- id: see_certificate
+  translation: Se sertifikat
+
+# Experience widget
+
+- id: present
+  translation: Nå
+
+# Pages widget
+
+- id: more_pages
+  translation: Se alle
+
+- id: more_posts
+  translation: Se alle innlegg
+
+- id: more_talks
+  translation: Se alle presentasjoner
+
+- id: more_publications
+  translation: See alle publiseringer
+
+# Contact widget
+
+- id: contact_name
+  translation: Navn
+
+- id: contact_email
+  translation: E-post
+
+- id: contact_message
+  translation: Melding
+
+- id: contact_send
+  translation: Send
+
+- id: book_appointment
+  translation: Be om en avtale
+
+# Publication/Talk details
+
+- id: abstract
+  translation: Sammendrag
+
+- id: publication
+  translation: Publisering
+
+- id: publication_type
+  translation: Type
+
+- id: date
+  translation: Dato
+
+- id: last_updated
+  translation: Sist oppdatert den
+
+- id: event
+  translation: Arrangement
+
+- id: location
+  translation: Sted
+
+- id: pub_uncat
+  translation: Ukategorisert
+
+- id: pub_conf
+  translation: Konferanseartikkel
+
+- id: pub_journal
+  translation: Tidskriftsartikel
+
+- id: pub_preprint
+  translation: Opprinnelig manus (preprint)
+
+- id: pub_report
+  translation: Rapport
+
+- id: pub_book
+  translation: Bok
+
+- id: pub_book_section
+  translation: Bokkapittel
+
+- id: pub_thesis
+  translation: Oppgave
+
+- id: pub_patent
+  translation: Patent
+
+# Project details
+
+- id: open_project_site
+  translation: Go til prosjektside
+
+# Content types for default archive page titles and search results
+
+- id: posts
+  translation: Innlegg
+
+- id: publications
+  translation: Publiseringer
+
+- id: talks
+  translation: Foredrag
+
+- id: projects
+  translation: Prosjekter
+
+- id: slides
+  translation: Presentasjoner
+
+# Search
+
+- id: search
+  translation: Søk
+
+- id: search_placeholder
+  translation: Søk...
+
+- id: search_results
+  translation: resultater funnet
+
+- id: search_no_results
+  translation: Ingen resultater funnet
+
+# Error 404
+
+- id: page_not_found
+  translation: Siden ble ikke funnet
+
+- id: 404_recommendations
+  translation: Kanskje du lette etter noe av dette?
+
+# Cookie consent
+
+- id: cookie_message
+  translation: Denne siden bruker informasjonskapsler (cookies) for å bidra til den beste opplevelsen av denne nettsiden.
+
+- id: cookie_dismiss
+  translation: Skjønner!
+
+- id: cookie_learn
+  translation: Lær mer

+ 1 - 1
wowchemy/layouts/index.webmanifest

@@ -2,7 +2,7 @@
 {
   "name": "{{site.Title}}",
   "short_name": "{{site.Title}}",
-  "lang": "{{site.LanguageCode}}",
+  "lang": "{{ site.LanguageCode | default "en-us" }}",
   "theme_color": "{{ $scr.Get "primary" }}",
   "background_color": "{{ $scr.Get "primary" }}",
   "icons": [{

+ 3 - 1
wowchemy/layouts/partials/comments.html

@@ -1,4 +1,6 @@
-{{ if site.Params.comments.engine | and (index site.Params.comments.commentable .Type) | and (ne .Params.commentable false) | or .Params.commentable }}
+{{ $commentable_map := site.Params.comments.commentable | default dict }}
+{{ $commentable_bool := index $commentable_map .Type | default false }}
+{{ if site.Params.comments.engine | and $commentable_bool | and (ne .Params.commentable false) | or .Params.commentable }}
 <section id="comments">
   {{ if eq site.Params.comments.engine 1 }}
     {{ partial "comments/disqus.html" . }}

+ 1 - 1
wowchemy/layouts/partials/comments/disqus.html

@@ -1,7 +1,7 @@
 {{ if site.Params.comments.disqus.shortname }}
 <div id="disqus_thread"></div>
 <script>
-  let disqus_config = function () {
+  var disqus_config = function () {
     {{with .Params.disqus_identifier }}this.page.identifier = '{{ . }}';{{end}}
     {{with .Params.disqus_title }}this.page.title = '{{ . }}';{{end}}
     {{with .Params.disqus_url }}this.page.url = '{{ . | html  }}';{{end}}

+ 3 - 1
wowchemy/layouts/partials/page_metadata.html

@@ -46,7 +46,9 @@
   {{ end }}
 
   {{/* Show Disqus comment count if enabled. */}}
-  {{ $disqus_enabled := eq site.Params.comments.engine 1 | and (index site.Params.comments.commentable $page.Type) | and (ne $page.Params.commentable false) | or $page.Params.commentable }}
+  {{ $commentable_map := site.Params.comments.commentable | default dict }}
+  {{ $commentable_bool := index $commentable_map $page.Type | default false }}
+  {{ $disqus_enabled := eq site.Params.comments.engine 1 | and $commentable_bool | and (ne $page.Params.commentable false) | or $page.Params.commentable }}
   {{ if and $disqus_enabled (site.Params.comments.disqus.show_count | default true) }}
   <span class="middot-divider"></span>
   <a href="{{ $page.RelPermalink }}#disqus_thread"><!-- Count will be inserted here --></a>

+ 5 - 3
wowchemy/layouts/partials/site_footer.html

@@ -19,7 +19,9 @@
   {{ partial "site_footer_license" . }}
 
   <p class="powered-by">
-    {{ if not site.Params.i_am_a_sponsor }}
+    {{ $is_sponsor := site.Params.i_am_a_sponsor | default false }}
+    {{ $hide_published_with_footer := site.Params.power_ups.hide_published_with | default true }}
+    {{ if not (and $is_sponsor $hide_published_with_footer) }}
     Published with
     <a href="https://wowchemy.com" target="_blank" rel="noopener">Wowchemy</a>  —
     the free, <a href="https://github.com/wowchemy/wowchemy-hugo-modules" target="_blank" rel="noopener">
@@ -27,8 +29,8 @@
     {{ end }}
 
     {{ if not (in (slice "book" "docs" "updates") .Type) }}
-    <span class="float-right" aria-hidden="true">
-      <a href="#" class="back-to-top">
+    <span class="float-right">
+      <a href="#" class="back-to-top" aria-label="Back to top">
         <span class="button_icon">
           <i class="fas fa-chevron-up fa-2x"></i>
         </span>

+ 3 - 3
wowchemy/layouts/partials/site_head.html

@@ -80,9 +80,9 @@
     {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.fontAwesome.url $css.fontAwesome.version) $css.fontAwesome.sri | safeHTML }}
     {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.fancybox.url $css.fancybox.version) $css.fancybox.sri | safeHTML }}
 
-    {{/* Default to enabling highlighting, but allow the user to override it in .Params or site.Params.
+    {{/* Default to disabling highlighting, but allow the user to override it in .Params or site.Params.
          Use $scr to store "highlight_enabled", so that we can read it again in footer.html. */}}
-    {{ $scr.Set "highlight_enabled" true }}
+    {{ $scr.Set "highlight_enabled" false }}
     {{ if isset .Params "highlight" }}
       {{ $scr.Set "highlight_enabled" .Params.highlight }}
     {{ else if isset site.Params "highlight" }}
@@ -160,7 +160,7 @@
   {{ partial "marketing/google_tag_manager" . }}
 
   {{/* Netlify Identity integration. */}}
-  {{ if .IsHome | and (site.Params.cms.netlify_cms | default true) }}
+  {{ if .IsHome | and (site.Params.cms.netlify_cms | default false) }}
   <script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
   {{ end }}
 

+ 7 - 2
wowchemy/layouts/partials/site_js.html

@@ -6,8 +6,13 @@
       <script src="{{ printf "/js/vendor/%s" ($scr.Get "vendor_js_filename") | relURL }}"></script>
     {{ else }}
       {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.jQuery.url $js.jQuery.version) $js.jQuery.sri | safeHTML }}
-      {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.imagesLoaded.url $js.imagesLoaded.version) $js.imagesLoaded.sri | safeHTML }}
-      {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.isotope.url $js.isotope.version) $js.isotope.sri | safeHTML }}
+
+      {{ $require_isotope := site.Params.require_isotope | default true }}
+      {{ if $require_isotope }}
+        {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.imagesLoaded.url $js.imagesLoaded.version) $js.imagesLoaded.sri | safeHTML }}
+        {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.isotope.url $js.isotope.version) $js.isotope.sri | safeHTML }}
+      {{ end }}
+
       {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.fancybox.url $js.fancybox.version) $js.fancybox.sri | safeHTML }}
       {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.instantpage.url $js.instantpage.version) $js.instantpage.sri | safeHTML }}
 

+ 8 - 0
wowchemy/test/config.yaml

@@ -0,0 +1,8 @@
+title: Wowchemy Test
+module:
+  imports:
+    - path: github.com/wowchemy/wowchemy-hugo-modules/wowchemy
+outputs:
+  home: [HTML, RSS, JSON, WebAppManifest]
+params:
+  require_isotope: false

+ 3 - 0
wowchemy/test/content/home/index.md

@@ -0,0 +1,3 @@
+---
+type: widget_page
+---

+ 9 - 0
wowchemy/test/content/home/section.md

@@ -0,0 +1,9 @@
+---
+widget: blank
+headless: true
+weight: 1
+design:
+  columns: '1'
+---
+
+Hello world 😃

+ 7 - 0
wowchemy/test/go.mod

@@ -0,0 +1,7 @@
+module github.com/wowchemy/wowchemy-hugo-modules/test
+
+go 1.15
+
+require github.com/wowchemy/wowchemy-hugo-modules/wowchemy master
+
+replace github.com/wowchemy/wowchemy-hugo-modules/wowchemy => ../

+ 1 - 0
wowchemy/test/view.sh

@@ -0,0 +1 @@
+hugo server -p 1330 --minify