mirror of
https://gitlab.com/ansol/web-ansol.org.git
synced 2024-09-18 07:45:18 +00:00
restart project
This commit is contained in:
commit
d27f43000e
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "academic"]
|
||||
path = academic
|
||||
url = https://gitlab.com/gsilvapt/ansol-hugo-academic.git
|
6
archetypes/default.md
Normal file
6
archetypes/default.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
draft: true
|
||||
---
|
||||
|
4
config.toml
Normal file
4
config.toml
Normal file
|
@ -0,0 +1,4 @@
|
|||
baseURL = "http://example.org/"
|
||||
languageCode = "en-us"
|
||||
title = "My New Hugo Site"
|
||||
theme = "academic"
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
{"Target":"css/academic.css","MediaType":"text/css","Data":{}}
|
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 821 B |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
20
themes/academic/.editorconfig
Normal file
20
themes/academic/.editorconfig
Normal file
|
@ -0,0 +1,20 @@
|
|||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.toml]
|
||||
max_line_length = 100
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[{layouts/shortcodes/*.html, layouts/_default/_markup/*.html}]
|
||||
insert_final_newline = false
|
12
themes/academic/.github/FUNDING.yml
vendored
Normal file
12
themes/academic/.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: gcushen # 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
|
41
themes/academic/.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
41
themes/academic/.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
name: "\U0001F41B Bug report"
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Welcome to Academic's GitHub repo 👋
|
||||
|
||||
We use GitHub only for bug reports and feature requests - it's our project management tool.
|
||||
|
||||
For **help** and **questions**, please join our **[community chat](https://spectrum.chat/academic)** or use the **[forum](https://discourse.gohugo.io/c/themes)** 🚑.
|
||||
|
||||
Also, you can search and browse the extensive [Academic](https://sourcethemes.com/academic/docs/) and [Hugo](https://gohugo.io/documentation/) **documentation**.
|
||||
|
||||
For questions on _Blogdown_, please reach out to the [Blogdown community](https://github.com/rstudio/blogdown).
|
||||
|
||||
### Describe the bug
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
### To Reproduce
|
||||
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. See error '...'
|
||||
|
||||
### Expected behavior
|
||||
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
### Technical details:
|
||||
|
||||
* Academic Version:
|
||||
* Hugo Version:
|
||||
* Browser/OS:
|
||||
|
||||
If applicable, add screenshots to help explain the issue.
|
22
themes/academic/.github/ISSUE_TEMPLATE/feature-request.md
vendored
Normal file
22
themes/academic/.github/ISSUE_TEMPLATE/feature-request.md
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
name: "\U0001F680 Feature request"
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Feature Request
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
11
themes/academic/.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
11
themes/academic/.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
### Purpose
|
||||
|
||||
Describe the purpose of this change. If there is an existing issue that is resolved by this pull request, please reference it in the form `Fixes #1234` where 1234 is the relevant issue number.
|
||||
|
||||
### Screenshots
|
||||
|
||||
If this is a GUI change, try to include screenshots of the change. If not, please delete this section.
|
||||
|
||||
### Documentation
|
||||
|
||||
If this is an enhancement, add a link here to the corresponding pull request on https://github.com/sourcethemes/academic-www or describe the documentation changes necessary.
|
43
themes/academic/.github/contributing.md
vendored
Normal file
43
themes/academic/.github/contributing.md
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
# Contributing to Academic
|
||||
|
||||
For **help**, **support**, and **questions** please use our **[community chat](https://spectrum.chat/academic)** 🚑.
|
||||
|
||||
---
|
||||
|
||||
## Where to Start
|
||||
|
||||
Learn [how to contribute code on Github](https://codeburst.io/a-step-by-step-guide-to-making-your-first-github-contribution-5302260a2940).
|
||||
|
||||
If you're a developer looking to contribute, but you're not sure where to begin, check out the [good first issue](https://github.com/gcushen/hugo-academic/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) label on Github, which contains small tasks that have been specifically flagged as being friendly to new contributors.
|
||||
|
||||
After that, if you're looking for something a little more challenging to sink your teeth into, there's a broader [help wanted](https://github.com/gcushen/hugo-academic/labels/help%20wanted) label encompassing issues which need some love.
|
||||
|
||||
If you have a straightforward bug fix or improvement, feel free to contribute it in a [Pull Request](https://github.com/gcushen/hugo-academic/pulls).
|
||||
|
||||
If you have an idea for a new feature, please start by [searching the issues](https://github.com/gcushen/hugo-academic/issues) to check that the feature has not already been suggested and then suggest it by [opening a new issue](https://github.com/gcushen/hugo-academic/issues/new/choose), as adding new features to Academic first requires some analysis around the design and spec.
|
||||
|
||||
To contribute a **new language pack**, refer to the [language pack guide](https://sourcethemes.com/academic/docs/language/#create-or-modify-a-language-pack). Once created, place you language pack in `academic/i18n/`, add the name of the language to `academic/data/i18n/language.yaml`, and open a Pull Request on Github with these two files.
|
||||
|
||||
To contribute to **Academic Admin**, the automatic publication importer, refer to [its dedicated Github repository](https://github.com/sourcethemes/academic-admin).
|
||||
|
||||
## Stickers
|
||||
|
||||
🖼️ [Decorate your laptop or journal with an Academic **sticker**](https://www.redbubble.com/people/neutreno/works/34387919-academic)
|
||||
|
||||
## Donations
|
||||
|
||||
As a pure community-driven open source project, we welcome your support:
|
||||
|
||||
- ☕️ [**Donate a coffee**](https://paypal.me/cushen)
|
||||
- 💵 [Become a backer on **Patreon**](https://www.patreon.com/cushen)
|
||||
|
||||
## Other ways to help
|
||||
|
||||
If you're not a developer there are still plenty of ways that you can help. We always need help with:
|
||||
|
||||
- Helping our Academic community on the [chat](https://spectrum.chat/academic)
|
||||
- Improving the [documentation](https://sourcethemes.com/academic/docs/) and writing tutorials
|
||||
- Just click the _Edit_ button at the bottom of pages or contribute to the [documentation repository](https://github.com/sourcethemes/academic-www)
|
||||
- Testing and quality assurance
|
||||
- Hosting local Academic themed events or meetups
|
||||
- Promoting Academic to others by blogging, vlogging, code streaming, talking etc.
|
26
themes/academic/.github/stale.yml
vendored
Normal file
26
themes/academic/.github/stale.yml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 30
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- keep
|
||||
- enhancement
|
||||
- bug
|
||||
- documentation
|
||||
- security
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had any
|
||||
recent activity. The resources of the Academic team are limited, and so we are asking for your help.
|
||||
|
||||
If this is a **bug** and you can still reproduce this error on the <code>master</code> branch, please reply with all of the information you have about it in order to keep the issue open.
|
||||
|
||||
If this is a **feature request**, and you feel that it is still relevant and valuable, please tell us why.
|
||||
|
||||
This issue will automatically close soon if no further activity occurs. Thank you for your contributions.
|
||||
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
17
themes/academic/.github/support.md
vendored
Normal file
17
themes/academic/.github/support.md
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
# How to get support for Academic 👨💬👩💬
|
||||
|
||||
For **help** and **questions** please join our **[community chat](https://spectrum.chat/academic)** or use the **[forum](https://discourse.gohugo.io/c/themes)** 🚑.
|
||||
|
||||
Please **_do not_** raise an issue on GitHub.
|
||||
|
||||
Also, you can search and browse the extensive [Academic](https://sourcethemes.com/academic/docs/) and [Hugo](https://gohugo.io/documentation/) **documentation**.
|
||||
|
||||
For questions on _Blogdown_, please reach out to the [Blogdown community](https://github.com/rstudio/blogdown).
|
||||
|
||||
Issues which are not bug reports or feature requests will be closed.
|
||||
|
||||
## Why not GitHub?
|
||||
|
||||
GitHub is our project management tool, it's the place where our volunteers contribute. We use the issue list to keep track of bugs and new features that we are working on. We do this openly for transparency.
|
||||
|
||||
With the chat and forum, you can leverage the knowledge of our wider community to get help with any problems you are having with Academic. Please keep in mind that Academic is Free Open Source Software (FOSS), and free support is provided by the goodwill of our wonderful community members.
|
12
themes/academic/.gitignore
vendored
Normal file
12
themes/academic/.gitignore
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
# IDE specific
|
||||
.idea/
|
||||
.vscode/
|
||||
|
||||
# Hugo
|
||||
exampleSite/public/
|
||||
|
||||
# Jupyter
|
||||
.ipynb_checkpoints/
|
||||
|
||||
# Node
|
||||
node_modules/
|
20
themes/academic/LICENSE.md
Normal file
20
themes/academic/LICENSE.md
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016-present George Cushen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
159
themes/academic/README.md
Normal file
159
themes/academic/README.md
Normal file
|
@ -0,0 +1,159 @@
|
|||
<p align="center"><a href="https://sourcethemes.com/academic/" target="_blank" rel="noopener"><img src="https://sourcethemes.com/academic/img/logo_200px.png" alt="Academic logo"></a></p>
|
||||
|
||||
# [Academic](https://sourcethemes.com/academic/): the website builder for [Hugo](https://gohugo.io)
|
||||
|
||||
### The Page Builder to Easily Create Professional Websites :pencil2: :newspaper: :rocket:
|
||||
|
||||
**Create a free website with Academic using Markdown, Jupyter, or RStudio. Choose a beautiful color theme and build anything with the Page Builder - over 50 _widgets_, _themes_, and _language packs_ included!**
|
||||
|
||||
[Check out the latest **demo**](https://academic-demo.netlify.app) 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.
|
||||
|
||||
- 👉 [**Get Started**](https://sourcethemes.com/academic/docs/install/)
|
||||
- 📚 [View the **documentation**](https://sourcethemes.com/academic/docs/)
|
||||
- 💬 [Chat with the **Academic community**](https://spectrum.chat/academic) or [**Hugo community**](https://discourse.gohugo.io)
|
||||
- 🐦 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** and **unlock rewards**](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/)
|
||||
|
||||
**Key features:**
|
||||
|
||||
- **Page builder** - Create *anything* with [**widgets**](https://sourcethemes.com/academic/docs/page-builder/) and [**elements**](https://sourcethemes.com/academic/docs/writing-markdown-latex/)
|
||||
- **Edit any type of content** - Blog posts, publications, talks, slides, projects, and more!
|
||||
- **Create content** in [**Markdown**](https://sourcethemes.com/academic/docs/writing-markdown-latex/), [**Jupyter**](https://sourcethemes.com/academic/docs/jupyter/), or [**RStudio**](https://sourcethemes.com/academic/docs/install/#install-with-rstudio)
|
||||
- **Plugin System** - Fully customizable [**color** and **font themes**](https://sourcethemes.com/academic/themes/)
|
||||
- **Display Code and Math** - Code highlighting and [LaTeX math](https://en.wikibooks.org/wiki/LaTeX/Mathematics) supported
|
||||
- **Integrations** - [Google Analytics](https://analytics.google.com), [Disqus commenting](https://disqus.com), Maps, Contact Forms, and more!
|
||||
- **Beautiful Site** - Simple and refreshing one page design
|
||||
- **Industry-Leading SEO** - Help get your website found on search engines and social media
|
||||
- **Media Galleries** - Display your images and videos with captions in a customizable gallery
|
||||
- **Mobile Friendly** - Look amazing on every screen with a mobile friendly version of your site
|
||||
- **Multi-language** - 15+ language packs including English, 中文, and Português
|
||||
- **Multi-user** - Each author gets their own profile page
|
||||
- **Privacy Pack** - Assists with GDPR
|
||||
- **Stand Out** - Bring your site to life with animation, parallax backgrounds, and scroll effects
|
||||
- **One-Click Deployment** - No servers. No databases. Only files.
|
||||
|
||||
## Themes
|
||||
|
||||
Academic comes with **automatic day (light) and night (dark) mode** built-in. Alternatively, click the sun/moon icon in the top right of the [Demo](https://academic-demo.netlify.app) to set your preferred mode!
|
||||
|
||||
Choose a stunning theme for your site and [customize it](https://sourcethemes.com/academic/docs/customization/#custom-theme) to your liking:
|
||||
|
||||
[![Themes](https://raw.githubusercontent.com/gcushen/hugo-academic/master/images/themes.png)](https://sourcethemes.com/academic/themes/)
|
||||
|
||||
[Browse more themes...](https://sourcethemes.com/academic/themes/)
|
||||
|
||||
## The Future of Technical Content Writing
|
||||
|
||||
[![Writing technical content](https://sourcethemes.com/academic/img/docs/writing-technical-content.gif)](https://academic-demo.netlify.apppost/writing-technical-content/)
|
||||
|
||||
## Ecosystem
|
||||
|
||||
* **[Academic Admin](https://github.com/sourcethemes/academic-admin):** An admin tool to import publications from BibTeX or import assets for an offline site
|
||||
* **[Academic Scripts](https://github.com/sourcethemes/academic-scripts):** Scripts to help migrate content to new versions of Academic
|
||||
|
||||
## Install
|
||||
|
||||
You can choose from one of the following four methods to install:
|
||||
|
||||
* **one-click install using your web browser (recommended)**
|
||||
* install on your computer using Git with the Command Prompt/Terminal app
|
||||
* install on your computer by downloading the ZIP files
|
||||
* install on your computer with RStudio
|
||||
|
||||
### Install with web browser
|
||||
|
||||
[**Create your site now with Netlify** :rocket:](https://app.netlify.com/start/deploy?repository=https://github.com/sourcethemes/academic-kickstart)
|
||||
|
||||
* One-click install of Academic creates an `academic-kickstart` repository in your GitHub or GitLab account
|
||||
* Netlify will provide you with a customizable URL to access your new site, [or get your own domain](https://sourcethemes.com/academic/docs/domain/)
|
||||
* Around 1-5 minutes after editing content in your repository, your site will automatically update
|
||||
- If your site fails to update, [login to Netlify](https://www.netlify.com/), click your site, go to **Deploys**, and review the latest deploy log for any errors
|
||||
* To **easily edit your site in a rich online editor in your browser**,
|
||||
- [Login to Netlify](https://www.netlify.com/) and click the site you deployed with Netlify
|
||||
- Go to **Settings > Identity**, and select **Enable Identity** service
|
||||
- Under **Registration** preferences, select **Invite Only**
|
||||
- Scroll down to **Services > Git Gateway**, and click **Enable Git Gateway**
|
||||
- Head over to **`YOUR_SITE.com/admin/`** to view your content management panel and begin publishing content
|
||||
- For support with _Netlify CMS_ admin panel, refer to the [Netlify CMS docs](https://www.netlifycms.org/docs/add-to-your-site/#authentication) and the very active [Netlify CMS community](https://www.netlifycms.org/community/)
|
||||
* To edit your site in a [Markdown editor](https://www.typora.io) on your computer,
|
||||
- Perform the steps in the [*Install with Git*](#install-with-git) section below
|
||||
|
||||
Once you have followed the link above to automatically install Academic, head on over to your new `academic-kickstart` repository in your GitHub (or GitLab) account and [personalize your site by editing the files in](https://sourcethemes.com/academic/docs/get-started/) `config/_default/`. Shortly after saving (i.e. *committing* a file), your site will automatically update.
|
||||
|
||||
View the [Homepage Builder](https://sourcethemes.com/academic/docs/page-builder/) and [Content](https://sourcethemes.com/academic/docs/managing-content/) guides to learn how to add widgets and content. For inspiration, refer to the [Markdown content](https://github.com/gcushen/hugo-academic/tree/master/exampleSite) which powers the [Demo](https://academic-demo.netlify.app).
|
||||
|
||||
### Install with Git
|
||||
|
||||
Prerequisites:
|
||||
|
||||
* [Download and install Git](https://git-scm.com/downloads)
|
||||
* [Download and install Hugo Extended v0.65-v0.72](https://gohugo.io/getting-started/installing/#quick-install)
|
||||
|
||||
Install:
|
||||
|
||||
1. [Fork](https://github.com/sourcethemes/academic-kickstart#fork-destination-box) the *Academic Kickstart* repository to create a new website
|
||||
* If you already created your site with **Netlify**, then skip this step
|
||||
2. Clone your fork to your computer with Git, replacing `sourcethemes` in the command below with your GitHub username:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/sourcethemes/academic-kickstart.git My_Website
|
||||
```
|
||||
|
||||
3. Initialize the theme:
|
||||
|
||||
```bash
|
||||
cd My_Website
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
### Install with ZIP
|
||||
|
||||
Prerequisites:
|
||||
|
||||
* [Download and install Hugo Extended v0.65-v0.72](https://gohugo.io/getting-started/installing/#quick-install)
|
||||
|
||||
Install:
|
||||
|
||||
1. [Download](https://github.com/sourcethemes/academic-kickstart/archive/master.zip) and extract *Academic Kickstart*
|
||||
2. [Download](https://github.com/gcushen/hugo-academic/archive/master.zip) and extract the *Academic theme* files from the `hugo-academic-master` folder to the `themes/academic/` folder in *Academic Kickstart*
|
||||
|
||||
### Install with RStudio
|
||||
|
||||
[Install Academic with RStudio](https://sourcethemes.com/academic/docs/install/#install-with-rstudio)
|
||||
|
||||
## Demo content
|
||||
|
||||
For inspiration, refer to the [Markdown content](https://github.com/gcushen/hugo-academic/tree/master/exampleSite) which powers the [Demo](https://academic-demo.netlify.app).
|
||||
|
||||
If you wish to initialise your site with the demo content, copy the contents of the `themes/academic/exampleSite/` folder to your website root folder, overwriting existing files if necessary. The `exampleSite` folder contains an example config file and content to help you get started. The following command can be used to accomplish this:
|
||||
|
||||
```bash
|
||||
cp -av themes/academic/exampleSite/* .
|
||||
```
|
||||
|
||||
## Get Started
|
||||
|
||||
[View the guide to Personalize and Deploy your new site](https://sourcethemes.com/academic/docs/get-started/).
|
||||
|
||||
## Updating
|
||||
|
||||
[View the Update Guide](https://sourcethemes.com/academic/docs/update/).
|
||||
|
||||
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
|
||||
|
||||
Copyright 2016-present [George Cushen](https://georgecushen.com).
|
||||
|
||||
Released under the [MIT](https://github.com/gcushen/hugo-academic/blob/master/LICENSE.md) license.
|
||||
|
||||
[![Analytics](https://ga-beacon.appspot.com/UA-78646709-2/hugo-academic/readme?pixel)](https://github.com/igrigorik/ga-beacon)
|
BIN
themes/academic/academic.png
Normal file
BIN
themes/academic/academic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 217 KiB |
68
themes/academic/archetypes/authors/_index.md
Normal file
68
themes/academic/archetypes/authors/_index.md
Normal file
|
@ -0,0 +1,68 @@
|
|||
---
|
||||
# Display name
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
|
||||
# Username (this should match the folder name and the name on publications)
|
||||
authors:
|
||||
- "{{ urlize .Name }}"
|
||||
|
||||
# Is this the primary user of the site?
|
||||
superuser: false
|
||||
|
||||
# Role/position (e.g., Professor of Artificial Intelligence)
|
||||
role:
|
||||
|
||||
# Organizations/Affiliations
|
||||
organizations:
|
||||
- name:
|
||||
url: ""
|
||||
|
||||
# Short bio (displayed in user profile at end of posts)
|
||||
bio:
|
||||
|
||||
# List each interest with a dash
|
||||
interests:
|
||||
- Interest 1
|
||||
- Interest 2
|
||||
|
||||
education:
|
||||
courses:
|
||||
- course: Title course 1
|
||||
institution: Name of Institution
|
||||
year: 2012
|
||||
- course: Title course 1
|
||||
institution: Name of Institution
|
||||
year: 2012
|
||||
|
||||
# Social/Academic Networking
|
||||
# For available icons, see: https://sourcethemes.com/academic/docs/page-builder/#icons
|
||||
# For an email link, use "fas" icon pack, "envelope" icon, and a link in the
|
||||
# form "mailto:your-email@example.com" or "#contact" for contact widget.
|
||||
social:
|
||||
- icon: envelope
|
||||
icon_pack: fas
|
||||
link: '#contact' # For a direct email link, use "mailto:test@example.org".
|
||||
- icon: twitter
|
||||
icon_pack: fab
|
||||
link: https://twitter.com/USERNAME
|
||||
- icon: google-scholar
|
||||
icon_pack: ai
|
||||
link: https://scholar.google.com/citations?user=PERSON-ID
|
||||
- icon: github
|
||||
icon_pack: fab
|
||||
link: https://github.com/USERNAME
|
||||
# Link to a PDF of your resume/CV from the About widget.
|
||||
# To enable, copy your resume/CV to `static/files/cv.pdf` and uncomment the lines below.
|
||||
# - icon: cv
|
||||
# icon_pack: ai
|
||||
# link: files/cv.pdf
|
||||
|
||||
# Enter email to display Gravatar (if Gravatar enabled in Config)
|
||||
email: ""
|
||||
|
||||
# Organizational groups that you belong to (for People widget)
|
||||
# Set this to `[]` or comment out if you are not using People widget.
|
||||
user_groups:
|
||||
- Group 1
|
||||
- Group 2
|
||||
---
|
BIN
themes/academic/archetypes/authors/avatar.jpg
Normal file
BIN
themes/academic/archetypes/authors/avatar.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
29
themes/academic/archetypes/default.md
Normal file
29
themes/academic/archetypes/default.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
# Documentation: https://sourcethemes.com/academic/docs/managing-content/
|
||||
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
subtitle: ""
|
||||
summary: ""
|
||||
authors: []
|
||||
tags: []
|
||||
categories: []
|
||||
date: {{ .Date }}
|
||||
lastmod: {{ .Date }}
|
||||
featured: false
|
||||
draft: false
|
||||
|
||||
# Featured image
|
||||
# To use, add an image named `featured.jpg/png` to your page's folder.
|
||||
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
|
||||
image:
|
||||
caption: ""
|
||||
focal_point: ""
|
||||
preview_only: false
|
||||
|
||||
# Projects (optional).
|
||||
# Associate this post with one or more of your projects.
|
||||
# Simply enter your project's folder or file name without extension.
|
||||
# E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
|
||||
# Otherwise, set `projects = []`.
|
||||
projects: []
|
||||
---
|
23
themes/academic/archetypes/docs.md
Normal file
23
themes/academic/archetypes/docs.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
# Documentation: https://sourcethemes.com/academic/docs/managing-content/
|
||||
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
linktitle: "{{ replace .Name "-" " " | title }}"
|
||||
summary:
|
||||
date: {{ .Date }}
|
||||
lastmod: {{ .Date }}
|
||||
draft: false # Is this a draft? true/false
|
||||
toc: true # Show table of contents? true/false
|
||||
type: docs # Do not modify.
|
||||
|
||||
# Add menu entry to sidebar.
|
||||
# - Substitute `example` with the name of your course/documentation folder.
|
||||
# - name: Declare this menu item as a parent with ID `name`.
|
||||
# - parent: Reference a parent ID if this page is a child.
|
||||
# - weight: Position of link in menu.
|
||||
menu:
|
||||
example:
|
||||
name: YourParentID
|
||||
# parent: YourParentID
|
||||
weight: 1
|
||||
---
|
48
themes/academic/archetypes/home.md
Normal file
48
themes/academic/archetypes/home.md
Normal file
|
@ -0,0 +1,48 @@
|
|||
+++
|
||||
# A section created with the Blank widget.
|
||||
widget = "blank" # See https://sourcethemes.com/academic/docs/page-builder/
|
||||
headless = true # This file represents a page section.
|
||||
active = true # Activate this widget? true/false
|
||||
weight = 1 # Order that this section will appear.
|
||||
|
||||
# Note: a full width section format can be enabled by commenting out the `title` and `subtitle` with a `#`.
|
||||
title = "{{ replace .Name "-" " " | title }}"
|
||||
subtitle = ""
|
||||
|
||||
[design]
|
||||
# Choose how many columns the section has. Valid values: 1 or 2.
|
||||
columns = "1"
|
||||
|
||||
[design.background]
|
||||
# Apply a background color, gradient, or image.
|
||||
# Uncomment (by removing `#`) an option to apply it.
|
||||
# Choose a light or dark text color by setting `text_color_light`.
|
||||
# Any HTML color name or Hex value is valid.
|
||||
|
||||
# Background color.
|
||||
# color = "navy"
|
||||
|
||||
# Background gradient.
|
||||
# gradient_start = "DeepSkyBlue"
|
||||
# gradient_end = "SkyBlue"
|
||||
|
||||
# Background image.
|
||||
# image = "image.jpg" # Name of image in `static/img/`.
|
||||
# image_darken = 0.6 # Darken the image? Range 0-1 where 0 is transparent and 1 is opaque.
|
||||
|
||||
# Text color (true=light or false=dark).
|
||||
# text_color_light = true
|
||||
|
||||
[design.spacing]
|
||||
# Customize the section spacing. Order is top, right, bottom, left.
|
||||
# padding = ["0px", "0px", "0px", "0px"]
|
||||
|
||||
[advanced]
|
||||
# Custom CSS.
|
||||
css_style = ""
|
||||
|
||||
# CSS class.
|
||||
css_class = ""
|
||||
+++
|
||||
|
||||
[**Add some elements here**](https://sourcethemes.com/academic/docs/writing-markdown-latex/)
|
29
themes/academic/archetypes/post/index.md
Normal file
29
themes/academic/archetypes/post/index.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
# Documentation: https://sourcethemes.com/academic/docs/managing-content/
|
||||
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
subtitle: ""
|
||||
summary: ""
|
||||
authors: []
|
||||
tags: []
|
||||
categories: []
|
||||
date: {{ .Date }}
|
||||
lastmod: {{ .Date }}
|
||||
featured: false
|
||||
draft: false
|
||||
|
||||
# Featured image
|
||||
# To use, add an image named `featured.jpg/png` to your page's folder.
|
||||
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
|
||||
image:
|
||||
caption: ""
|
||||
focal_point: ""
|
||||
preview_only: false
|
||||
|
||||
# Projects (optional).
|
||||
# Associate this post with one or more of your projects.
|
||||
# Simply enter your project's folder or file name without extension.
|
||||
# E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
|
||||
# Otherwise, set `projects = []`.
|
||||
projects: []
|
||||
---
|
41
themes/academic/archetypes/project/index.md
Normal file
41
themes/academic/archetypes/project/index.md
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
# Documentation: https://sourcethemes.com/academic/docs/managing-content/
|
||||
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
summary: ""
|
||||
authors: []
|
||||
tags: []
|
||||
categories: []
|
||||
date: {{ .Date }}
|
||||
|
||||
# Optional external URL for project (replaces project detail page).
|
||||
external_link: ""
|
||||
|
||||
# Featured image
|
||||
# To use, add an image named `featured.jpg/png` to your page's folder.
|
||||
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
|
||||
image:
|
||||
caption: ""
|
||||
focal_point: ""
|
||||
preview_only: false
|
||||
|
||||
# Custom links (optional).
|
||||
# Uncomment and edit lines below to show custom links.
|
||||
# links:
|
||||
# - name: Follow
|
||||
# url: https://twitter.com
|
||||
# icon_pack: fab
|
||||
# icon: twitter
|
||||
|
||||
url_code: ""
|
||||
url_pdf: ""
|
||||
url_slides: ""
|
||||
url_video: ""
|
||||
|
||||
# Slides (optional).
|
||||
# Associate this project with Markdown slides.
|
||||
# Simply enter your slide deck's filename without extension.
|
||||
# E.g. `slides = "example-slides"` references `content/slides/example-slides.md`.
|
||||
# Otherwise, set `slides = ""`.
|
||||
slides: ""
|
||||
---
|
69
themes/academic/archetypes/publication/index.md
Normal file
69
themes/academic/archetypes/publication/index.md
Normal file
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
# Documentation: https://sourcethemes.com/academic/docs/managing-content/
|
||||
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
authors: []
|
||||
date: {{ .Date }}
|
||||
doi: ""
|
||||
|
||||
# Schedule page publish date (NOT publication's date).
|
||||
publishDate: {{ .Date }}
|
||||
|
||||
# Publication type.
|
||||
# Legend: 0 = Uncategorized; 1 = Conference paper; 2 = Journal article;
|
||||
# 3 = Preprint / Working Paper; 4 = Report; 5 = Book; 6 = Book section;
|
||||
# 7 = Thesis; 8 = Patent
|
||||
publication_types: ["0"]
|
||||
|
||||
# Publication name and optional abbreviated publication name.
|
||||
publication: ""
|
||||
publication_short: ""
|
||||
|
||||
abstract: ""
|
||||
|
||||
# Summary. An optional shortened abstract.
|
||||
summary: ""
|
||||
|
||||
tags: []
|
||||
categories: []
|
||||
featured: false
|
||||
|
||||
# Custom links (optional).
|
||||
# Uncomment and edit lines below to show custom links.
|
||||
# links:
|
||||
# - name: Follow
|
||||
# url: https://twitter.com
|
||||
# icon_pack: fab
|
||||
# icon: twitter
|
||||
|
||||
url_pdf:
|
||||
url_code:
|
||||
url_dataset:
|
||||
url_poster:
|
||||
url_project:
|
||||
url_slides:
|
||||
url_source:
|
||||
url_video:
|
||||
|
||||
# Featured image
|
||||
# To use, add an image named `featured.jpg/png` to your page's folder.
|
||||
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
|
||||
image:
|
||||
caption: ""
|
||||
focal_point: ""
|
||||
preview_only: false
|
||||
|
||||
# Associated Projects (optional).
|
||||
# Associate this publication with one or more of your projects.
|
||||
# Simply enter your project's folder or file name without extension.
|
||||
# E.g. `internal-project` references `content/project/internal-project/index.md`.
|
||||
# Otherwise, set `projects: []`.
|
||||
projects: []
|
||||
|
||||
# Slides (optional).
|
||||
# Associate this publication with Markdown slides.
|
||||
# Simply enter your slide deck's filename without extension.
|
||||
# E.g. `slides: "example"` references `content/slides/example/index.md`.
|
||||
# Otherwise, set `slides: ""`.
|
||||
slides: ""
|
||||
---
|
26
themes/academic/archetypes/slides/index.md
Normal file
26
themes/academic/archetypes/slides/index.md
Normal file
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
# Documentation: https://sourcethemes.com/academic/docs/managing-content/
|
||||
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
summary: ""
|
||||
authors: []
|
||||
tags: []
|
||||
categories: []
|
||||
date: {{ .Date }}
|
||||
slides:
|
||||
# Choose a theme from https://github.com/hakimel/reveal.js#theming
|
||||
theme: black
|
||||
# Choose a code highlighting style (if highlighting enabled in `params.toml`)
|
||||
# Light style: github. Dark style: dracula (default).
|
||||
highlight_style: dracula
|
||||
---
|
||||
|
||||
# Title
|
||||
|
||||
Author Name
|
||||
|
||||
---
|
||||
|
||||
## Slide 2
|
||||
|
||||
...
|
68
themes/academic/archetypes/talk/index.md
Normal file
68
themes/academic/archetypes/talk/index.md
Normal file
|
@ -0,0 +1,68 @@
|
|||
---
|
||||
# Documentation: https://sourcethemes.com/academic/docs/managing-content/
|
||||
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
event:
|
||||
event_url:
|
||||
location:
|
||||
address:
|
||||
street:
|
||||
city:
|
||||
region:
|
||||
postcode:
|
||||
country:
|
||||
summary:
|
||||
abstract:
|
||||
|
||||
# Talk start and end times.
|
||||
# End time can optionally be hidden by prefixing the line with `#`.
|
||||
date: {{ .Date }}
|
||||
date_end: {{ .Date }}
|
||||
all_day: false
|
||||
|
||||
# Schedule page publish date (NOT talk date).
|
||||
publishDate: {{ .Date }}
|
||||
|
||||
authors: []
|
||||
tags: []
|
||||
|
||||
# Is this a featured talk? (true/false)
|
||||
featured: false
|
||||
|
||||
# Featured image
|
||||
# To use, add an image named `featured.jpg/png` to your page's folder.
|
||||
# Focal points: Smart, Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom, BottomRight.
|
||||
image:
|
||||
caption: ""
|
||||
focal_point: ""
|
||||
preview_only: false
|
||||
|
||||
# Custom links (optional).
|
||||
# Uncomment and edit lines below to show custom links.
|
||||
# links:
|
||||
# - name: Follow
|
||||
# url: https://twitter.com
|
||||
# icon_pack: fab
|
||||
# icon: twitter
|
||||
|
||||
# Optional filename of your slides within your talk's folder or a URL.
|
||||
url_slides:
|
||||
|
||||
url_code:
|
||||
url_pdf:
|
||||
url_video:
|
||||
|
||||
# Markdown Slides (optional).
|
||||
# Associate this talk with Markdown slides.
|
||||
# Simply enter your slide deck's filename without extension.
|
||||
# E.g. `slides = "example-slides"` references `content/slides/example-slides.md`.
|
||||
# Otherwise, set `slides = ""`.
|
||||
slides: ""
|
||||
|
||||
# Projects (optional).
|
||||
# Associate this post with one or more of your projects.
|
||||
# Simply enter your project's folder or file name without extension.
|
||||
# E.g. `projects = ["internal-project"]` references `content/project/deep-learning/index.md`.
|
||||
# Otherwise, set `projects = []`.
|
||||
projects: []
|
||||
---
|
31
themes/academic/assets/css/reveal.css
Normal file
31
themes/academic/assets/css/reveal.css
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*************************************************
|
||||
* Reveal JS
|
||||
**************************************************/
|
||||
|
||||
/* This is a copy of MathJax's `.mjx-chtml` with font-family added to override `.reveal span`. */
|
||||
/* See https://github.com/hakimel/reveal.js/issues/1924 */
|
||||
.reveal span.mjx-chtml {
|
||||
display: inline-block;
|
||||
line-height: 0;
|
||||
text-indent: 0;
|
||||
text-align: left;
|
||||
text-transform: none;
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-size: 100%;
|
||||
font-size-adjust: none;
|
||||
letter-spacing: normal;
|
||||
word-wrap: normal;
|
||||
word-spacing: normal;
|
||||
white-space: nowrap;
|
||||
float: none;
|
||||
direction: ltr;
|
||||
max-width: none;
|
||||
max-height: none;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 1px 0;
|
||||
font-family: MJXc-TeX-math-I,MJXc-TeX-math-Ix,MJXc-TeX-math-Iw;
|
||||
}
|
0
themes/academic/assets/css/reveal_custom.css
Normal file
0
themes/academic/assets/css/reveal_custom.css
Normal file
BIN
themes/academic/assets/images/icon.png
Normal file
BIN
themes/academic/assets/images/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
185
themes/academic/assets/js/academic-search.js
Normal file
185
themes/academic/assets/js/academic-search.js
Normal file
|
@ -0,0 +1,185 @@
|
|||
/*************************************************
|
||||
* Academic
|
||||
* https://github.com/gcushen/hugo-academic
|
||||
*
|
||||
* In-built Fuse based search algorithm.
|
||||
**************************************************/
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Configuration.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
// Configure Fuse.
|
||||
let fuseOptions = {
|
||||
shouldSort: true,
|
||||
includeMatches: true,
|
||||
tokenize: true,
|
||||
threshold: search_config.threshold, // Set to ~0.3 for parsing diacritics and CJK languages.
|
||||
location: 0,
|
||||
distance: 100,
|
||||
maxPatternLength: 32,
|
||||
minMatchCharLength: search_config.minLength, // Set to 1 for parsing CJK languages.
|
||||
keys: [
|
||||
{name:'title', weight:0.99}, /* 1.0 doesn't work o_O */
|
||||
{name:'summary', weight:0.6},
|
||||
{name:'authors', weight:0.5},
|
||||
{name:'content', weight:0.2},
|
||||
{name:'tags', weight:0.5},
|
||||
{name:'categories', weight:0.5}
|
||||
]
|
||||
};
|
||||
|
||||
// Configure summary.
|
||||
let summaryLength = 60;
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Functions.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
// Get query from URI.
|
||||
function getSearchQuery(name) {
|
||||
return decodeURIComponent((location.search.split(name + '=')[1] || '').split('&')[0]).replace(/\+/g, ' ');
|
||||
}
|
||||
|
||||
// Set query in URI without reloading the page.
|
||||
function updateURL(url) {
|
||||
if (history.replaceState) {
|
||||
window.history.replaceState({path:url}, '', url);
|
||||
}
|
||||
}
|
||||
|
||||
// Pre-process new search query.
|
||||
function initSearch(force, fuse) {
|
||||
let query = $("#search-query").val();
|
||||
|
||||
// If query deleted, clear results.
|
||||
if ( query.length < 1) {
|
||||
$('#search-hits').empty();
|
||||
}
|
||||
|
||||
// Check for timer event (enter key not pressed) and query less than minimum length required.
|
||||
if (!force && query.length < fuseOptions.minMatchCharLength)
|
||||
return;
|
||||
|
||||
// Do search.
|
||||
$('#search-hits').empty();
|
||||
searchAcademic(query, fuse);
|
||||
let newURL = window.location.protocol + "//" + window.location.host + window.location.pathname + '?q=' + encodeURIComponent(query) + window.location.hash;
|
||||
updateURL(newURL);
|
||||
}
|
||||
|
||||
// Perform search.
|
||||
function searchAcademic(query, fuse) {
|
||||
let results = fuse.search(query);
|
||||
// console.log({"results": results});
|
||||
|
||||
if (results.length > 0) {
|
||||
$('#search-hits').append('<h3 class="mt-0">' + results.length + ' ' + i18n.results + '</h3>');
|
||||
parseResults(query, results);
|
||||
} else {
|
||||
$('#search-hits').append('<div class="search-no-results">' + i18n.no_results + '</div>');
|
||||
}
|
||||
}
|
||||
|
||||
// Parse search results.
|
||||
function parseResults(query, results) {
|
||||
$.each( results, function(key, value) {
|
||||
let content_key = value.item.section;
|
||||
let content = "";
|
||||
let snippet = "";
|
||||
let snippetHighlights = [];
|
||||
|
||||
// Show abstract in results for content types where the abstract is often the primary content.
|
||||
if (["publication", "talk"].includes(content_key)) {
|
||||
content = value.item.summary;
|
||||
} else {
|
||||
content = value.item.content;
|
||||
}
|
||||
|
||||
if ( fuseOptions.tokenize ) {
|
||||
snippetHighlights.push(query);
|
||||
} else {
|
||||
$.each( value.matches, function(matchKey, matchValue) {
|
||||
if (matchValue.key == "content") {
|
||||
let start = (matchValue.indices[0][0]-summaryLength>0) ? matchValue.indices[0][0]-summaryLength : 0;
|
||||
let end = (matchValue.indices[0][1]+summaryLength<content.length) ? matchValue.indices[0][1]+summaryLength : content.length;
|
||||
snippet += content.substring(start, end);
|
||||
snippetHighlights.push(matchValue.value.substring(matchValue.indices[0][0], matchValue.indices[0][1]-matchValue.indices[0][0]+1));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (snippet.length < 1) {
|
||||
snippet += value.item.summary; // Alternative fallback: `content.substring(0, summaryLength*2);`
|
||||
}
|
||||
|
||||
// Load template.
|
||||
let template = $('#search-hit-fuse-template').html();
|
||||
|
||||
// Localize content types.
|
||||
if (content_key in content_type) {
|
||||
content_key = content_type[content_key];
|
||||
}
|
||||
|
||||
// Parse template.
|
||||
let templateData = {
|
||||
key: key,
|
||||
title: value.item.title,
|
||||
type: content_key,
|
||||
relpermalink: value.item.relpermalink,
|
||||
snippet: snippet
|
||||
};
|
||||
let output = render(template, templateData);
|
||||
$('#search-hits').append(output);
|
||||
|
||||
// Highlight search terms in result.
|
||||
$.each( snippetHighlights, function(hlKey, hlValue){
|
||||
$("#summary-"+key).mark(hlValue);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function render(template, data) {
|
||||
// Replace placeholders with their values.
|
||||
let key, find, re;
|
||||
for (key in data) {
|
||||
find = '\\{\\{\\s*' + key + '\\s*\\}\\}'; // Expect placeholder in the form `{{x}}`.
|
||||
re = new RegExp(find, 'g');
|
||||
template = template.replace(re, data[key]);
|
||||
}
|
||||
return template;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Initialize.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
// If Academic's in-built search is enabled and Fuse loaded, then initialize it.
|
||||
if (typeof Fuse === 'function') {
|
||||
// Wait for Fuse to initialize.
|
||||
$.getJSON(search_config.indexURI, function (search_index) {
|
||||
let fuse = new Fuse(search_index, fuseOptions);
|
||||
|
||||
// On page load, check for search query in URL.
|
||||
if (query = getSearchQuery('q')) {
|
||||
$("body").addClass('searching');
|
||||
$('.search-results').css({opacity: 0, visibility: "visible"}).animate({opacity: 1},200);
|
||||
$("#search-query").val(query);
|
||||
$("#search-query").focus();
|
||||
initSearch(true, fuse);
|
||||
}
|
||||
|
||||
// On search box key up, process query.
|
||||
$('#search-query').keyup(function (e) {
|
||||
clearTimeout($.data(this, 'searchTimer')); // Ensure only one timer runs!
|
||||
if (e.keyCode == 13) {
|
||||
initSearch(true, fuse);
|
||||
} else {
|
||||
$(this).data('searchTimer', setTimeout(function () {
|
||||
initSearch(false, fuse);
|
||||
}, 250));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
797
themes/academic/assets/js/academic.js
Normal file
797
themes/academic/assets/js/academic.js
Normal file
|
@ -0,0 +1,797 @@
|
|||
/*************************************************
|
||||
* Academic
|
||||
* https://github.com/gcushen/hugo-academic
|
||||
*
|
||||
* Core JS functions and initialization.
|
||||
**************************************************/
|
||||
|
||||
(function ($) {
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Responsive scrolling for URL hashes.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
// Dynamically get responsive navigation bar height for offsetting Scrollspy.
|
||||
function getNavBarHeight() {
|
||||
let $navbar = $('#navbar-main');
|
||||
let navbar_offset = $navbar.outerHeight();
|
||||
console.debug('Navbar height: ' + navbar_offset);
|
||||
return navbar_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Responsive hash scrolling.
|
||||
* Check for a URL hash as an anchor.
|
||||
* If it exists on current page, scroll to it responsively.
|
||||
* If `target` argument omitted (e.g. after event), assume it's the window's hash.
|
||||
*/
|
||||
function scrollToAnchor(target) {
|
||||
// If `target` is undefined or HashChangeEvent object, set it to window's hash.
|
||||
// Decode the hash as browsers can encode non-ASCII characters (e.g. Chinese symbols).
|
||||
target = (typeof target === 'undefined' || typeof target === 'object') ? decodeURIComponent(window.location.hash) : target;
|
||||
|
||||
// If target element exists, scroll to it taking into account fixed navigation bar offset.
|
||||
if ($(target).length) {
|
||||
// Escape special chars from IDs, such as colons found in Markdown footnote links.
|
||||
target = '#' + $.escapeSelector(target.substring(1)); // Previously, `target = target.replace(/:/g, '\\:');`
|
||||
|
||||
let elementOffset = Math.ceil($(target).offset().top - getNavBarHeight()); // Round up to highlight right ID!
|
||||
$('body').addClass('scrolling');
|
||||
$('html, body').animate({
|
||||
scrollTop: elementOffset
|
||||
}, 600, function () {
|
||||
$('body').removeClass('scrolling');
|
||||
});
|
||||
} else {
|
||||
console.debug('Cannot scroll to target `#' + target + '`. ID not found!');
|
||||
}
|
||||
}
|
||||
|
||||
// Make Scrollspy responsive.
|
||||
function fixScrollspy() {
|
||||
let $body = $('body');
|
||||
let data = $body.data('bs.scrollspy');
|
||||
if (data) {
|
||||
data._config.offset = getNavBarHeight();
|
||||
$body.data('bs.scrollspy', data);
|
||||
$body.scrollspy('refresh');
|
||||
}
|
||||
}
|
||||
|
||||
function removeQueryParamsFromUrl() {
|
||||
if (window.history.replaceState) {
|
||||
let urlWithoutSearchParams = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.hash;
|
||||
window.history.replaceState({path: urlWithoutSearchParams}, '', urlWithoutSearchParams);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for hash change event and fix responsive offset for hash links (e.g. Markdown footnotes).
|
||||
window.addEventListener("hashchange", scrollToAnchor);
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Add smooth scrolling to all links inside the main navbar.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
$('#navbar-main li.nav-item a.nav-link').on('click', function (event) {
|
||||
// Store requested URL hash.
|
||||
let hash = this.hash;
|
||||
|
||||
// If we are on a widget page and the navbar link is to a section on the same page.
|
||||
if (this.pathname === window.location.pathname && hash && $(hash).length && ($(".js-widget-page").length > 0)) {
|
||||
// Prevent default click behavior.
|
||||
event.preventDefault();
|
||||
|
||||
// Use jQuery's animate() method for smooth page scrolling.
|
||||
// The numerical parameter specifies the time (ms) taken to scroll to the specified hash.
|
||||
let elementOffset = Math.ceil($(hash).offset().top - getNavBarHeight()); // Round up to highlight right ID!
|
||||
|
||||
// Uncomment to debug.
|
||||
// let scrollTop = $(window).scrollTop();
|
||||
// let scrollDelta = (elementOffset - scrollTop);
|
||||
// console.debug('Scroll Delta: ' + scrollDelta);
|
||||
|
||||
$('html, body').animate({
|
||||
scrollTop: elementOffset
|
||||
}, 800);
|
||||
}
|
||||
});
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Hide mobile collapsable menu on clicking a link.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
$(document).on('click', '.navbar-collapse.show', function (e) {
|
||||
//get the <a> element that was clicked, even if the <span> element that is inside the <a> element is e.target
|
||||
let targetElement = $(e.target).is('a') ? $(e.target) : $(e.target).parent();
|
||||
|
||||
if (targetElement.is('a') && targetElement.attr('class') != 'dropdown-toggle') {
|
||||
$(this).collapse('hide');
|
||||
}
|
||||
});
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Filter publications.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
// Active publication filters.
|
||||
let pubFilters = {};
|
||||
|
||||
// Search term.
|
||||
let searchRegex;
|
||||
|
||||
// Filter values (concatenated).
|
||||
let filterValues;
|
||||
|
||||
// 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 () {
|
||||
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();
|
||||
}));
|
||||
|
||||
// Debounce input to prevent spamming filter requests.
|
||||
function debounce(fn, threshold) {
|
||||
let timeout;
|
||||
threshold = threshold || 100;
|
||||
return function debounced() {
|
||||
clearTimeout(timeout);
|
||||
let args = arguments;
|
||||
let _this = this;
|
||||
|
||||
function delayed() {
|
||||
fn.apply(_this, args);
|
||||
}
|
||||
|
||||
timeout = setTimeout(delayed, threshold);
|
||||
};
|
||||
}
|
||||
|
||||
// Flatten object by concatenating values.
|
||||
function concatValues(obj) {
|
||||
let value = '';
|
||||
for (let prop in obj) {
|
||||
value += obj[prop];
|
||||
}
|
||||
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() {
|
||||
let urlHash = window.location.hash.replace('#', '');
|
||||
let filterValue = '*';
|
||||
|
||||
// Check if hash is numeric.
|
||||
if (urlHash != '' && !isNaN(urlHash)) {
|
||||
filterValue = '.pubtype-' + urlHash;
|
||||
}
|
||||
|
||||
// Set filter.
|
||||
let filterGroup = 'pubtype';
|
||||
pubFilters[filterGroup] = filterValue;
|
||||
filterValues = concatValues(pubFilters);
|
||||
|
||||
// Activate filters.
|
||||
$grid_pubs.isotope();
|
||||
|
||||
// Set selected option.
|
||||
$('.pubtype-select').val(filterValue);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Google Maps or OpenStreetMap via Leaflet.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
function initMap() {
|
||||
if ($('#map').length) {
|
||||
let map_provider = $('#map-provider').val();
|
||||
let lat = $('#map-lat').val();
|
||||
let lng = $('#map-lng').val();
|
||||
let zoom = parseInt($('#map-zoom').val());
|
||||
let address = $('#map-dir').val();
|
||||
let api_key = $('#map-api-key').val();
|
||||
|
||||
if (map_provider == 1) {
|
||||
let map = new GMaps({
|
||||
div: '#map',
|
||||
lat: lat,
|
||||
lng: lng,
|
||||
zoom: zoom,
|
||||
zoomControl: true,
|
||||
zoomControlOpt: {
|
||||
style: 'SMALL',
|
||||
position: 'TOP_LEFT'
|
||||
},
|
||||
panControl: false,
|
||||
streetViewControl: false,
|
||||
mapTypeControl: false,
|
||||
overviewMapControl: false,
|
||||
scrollwheel: true,
|
||||
draggable: true
|
||||
});
|
||||
|
||||
map.addMarker({
|
||||
lat: lat,
|
||||
lng: lng,
|
||||
click: function (e) {
|
||||
let url = 'https://www.google.com/maps/place/' + encodeURIComponent(address) + '/@' + lat + ',' + lng + '/';
|
||||
window.open(url, '_blank')
|
||||
},
|
||||
title: address
|
||||
})
|
||||
} else {
|
||||
let map = new L.map('map').setView([lat, lng], zoom);
|
||||
if (map_provider == 3 && api_key.length) {
|
||||
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
|
||||
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',
|
||||
maxZoom: 18,
|
||||
id: 'mapbox.streets',
|
||||
accessToken: api_key
|
||||
}).addTo(map);
|
||||
} else {
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
}).addTo(map);
|
||||
}
|
||||
let marker = L.marker([lat, lng]).addTo(map);
|
||||
let url = lat + ',' + lng + '#map=' + zoom + '/' + lat + '/' + lng + '&layers=N';
|
||||
marker.bindPopup(address + '<p><a href="https://www.openstreetmap.org/directions?engine=osrm_car&route=' + url + '">Routing via OpenStreetMap</a></p>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* GitHub API.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
function printLatestRelease(selector, repo) {
|
||||
$.getJSON('https://api.github.com/repos/' + repo + '/tags').done(function (json) {
|
||||
let release = json[0];
|
||||
$(selector).append(' ' + release.name);
|
||||
}).fail(function (jqxhr, textStatus, error) {
|
||||
let err = textStatus + ", " + error;
|
||||
console.log("Request Failed: " + err);
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Toggle search dialog.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
function toggleSearchDialog() {
|
||||
if ($('body').hasClass('searching')) {
|
||||
// Clear search query and hide search modal.
|
||||
$('[id=search-query]').blur();
|
||||
$('body').removeClass('searching compensate-for-scrollbar');
|
||||
|
||||
// Remove search query params from URL as user has finished searching.
|
||||
removeQueryParamsFromUrl();
|
||||
|
||||
// Prevent fixed positioned elements (e.g. navbar) moving due to scrollbars.
|
||||
$('#fancybox-style-noscroll').remove();
|
||||
} else {
|
||||
// Prevent fixed positioned elements (e.g. navbar) moving due to scrollbars.
|
||||
if (!$('#fancybox-style-noscroll').length && document.body.scrollHeight > window.innerHeight) {
|
||||
$('head').append(
|
||||
'<style id="fancybox-style-noscroll">.compensate-for-scrollbar{margin-right:' +
|
||||
(window.innerWidth - document.documentElement.clientWidth) +
|
||||
'px;}</style>'
|
||||
);
|
||||
$('body').addClass('compensate-for-scrollbar');
|
||||
}
|
||||
|
||||
// Show search modal.
|
||||
$('body').addClass('searching');
|
||||
$('.search-results').css({opacity: 0, visibility: 'visible'}).animate({opacity: 1}, 200);
|
||||
$('#search-query').focus();
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Change Theme Mode (0: Day, 1: Night, 2: Auto).
|
||||
* ------------------------------------ |