mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-25 15:58:53 +00:00
Update toc with home baked scrollspy
This commit is contained in:
+1
-1
@@ -101,4 +101,4 @@ watch = true
|
||||
|
||||
[taxonomies]
|
||||
tag = "tags"
|
||||
category = "categories"
|
||||
category = ""
|
||||
@@ -10,6 +10,7 @@ weight: 01
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/overview/introduction/]
|
||||
toc: true
|
||||
notes:
|
||||
---
|
||||
|
||||
@@ -17,9 +18,9 @@ notes:
|
||||
|
||||
Hugo is a general-purpose website framework. Technically speaking, Hugo is a [static site generator][]. Unlike systems that dynamically build a page with each visitor request, Hugo builds pages when you create your content. Since websites are viewed far more often than they are edited, Hugo is designed to provide an optimal viewing experience for your website's end users and an ideal writing experience for authors.
|
||||
|
||||
Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [Surge][], [Aerobatic][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP.
|
||||
Websites built with Hugo are extremely fast and secure. Hugo sites can be hosted anywhere, including [Heroku][], [GoDaddy][], [DreamHost][], [GitHub Pages][], [Surge][], [Aerobatic][], [Firebase][], [Google Cloud Storage][], [Amazon S3][], [rackspace][], [Azure][], and [CloudFront][] and work well with CDNs. Hugo sites run without the need for a database or dependencies on expensive runtimes like Ruby, Python, or PHP.
|
||||
|
||||
We think of Hugo as the ideal website creation tool. With nearly instant build times and the ability to rebuild whenever a change is made, Hugo provides a very fast feedback, which is essential when you are designing websites and creating content.
|
||||
We think of Hugo as the ideal website creation tool. Hugo provides nearly instant build times and the ability to rebuild whenever a change is made, which is invaluable when you are designing websites and creating content.
|
||||
|
||||
## How Fast is Hugo?
|
||||
|
||||
@@ -40,6 +41,7 @@ Hugo is for people building a blog, a company site, a portfolio site, documentat
|
||||
|
||||
[Aerobatic]: https://www.aerobatic.com/
|
||||
[Amazon S3]: http://aws.amazon.com/s3/
|
||||
[Azure]: https://blogs.msdn.microsoft.com/acoat/2016/01/28/publish-a-static-web-site-using-azure-web-apps/
|
||||
[CloudFront]: http://aws.amazon.com/cloudfront/ "Amazon CloudFront"
|
||||
[DreamHost]: http://www.dreamhost.com/
|
||||
[Firebase]: https://firebase.google.com/docs/hosting/ "Firebase static hosting"
|
||||
@@ -51,5 +53,6 @@ Hugo is for people building a blog, a company site, a portfolio site, documentat
|
||||
[Jekyll]: http://jekyllrb.com/
|
||||
[Middleman]: https://middlemanapp.com/
|
||||
[Nanoc]: http://nanoc.ws/
|
||||
[rackspace]: https://www.rackspace.com/cloud/files
|
||||
[static site generator]: /about-hugo/benefits-of-static/
|
||||
[Surge]: https://surge.sh
|
||||
@@ -10,6 +10,7 @@ weight: 20
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
toc: false
|
||||
notes:
|
||||
---
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ weight: 10
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/about-hugo/features]
|
||||
toc: true
|
||||
notes:
|
||||
---
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ weight: 50
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/meta/license]
|
||||
toc: true
|
||||
notes:
|
||||
---
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ weight: 40
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/meta/roadmap]
|
||||
toc: false
|
||||
notes:
|
||||
---
|
||||
|
||||
@@ -18,16 +19,15 @@ In no particular order, here is what is currently being worked on for the Hugo p
|
||||
* Intelligently related posts ({{< issue 98 >}})
|
||||
* Even easier deployment to S3, SSH, GitHub, rsync. Give the [hosting and deployment][] section a shot.
|
||||
* Import from other website systems. There are already [existing migration tools][], but they don’t cover all major platforms.
|
||||
* An interactive web based editor (See the [related Discuss thread][])
|
||||
* An interactive web-based editor (See the [related Discuss thread][])
|
||||
* Additional [themes][], which are always ongoing and contributions are welcome!
|
||||
* Dynamic image resizing via shortcodes ({{< issue 1014 >}})
|
||||
* Native support for additional content formats (AsciiDoc {{< issue 1435>}}, reST {{< issue 1436 >}})
|
||||
* And, last but not least, *your* best ideas!
|
||||
* And, last but not least, [*your* best ideas!][]
|
||||
|
||||
## Contributions Welcome
|
||||
|
||||
Feel free to [contribute][] or open a new issue if you have an idea for a new feature.
|
||||
|
||||
Feel free to [contribute][] or [open a new issue][] if you have an idea for a new feature.
|
||||
|
||||
[#98]: https://github.com/spf13/hugo/issues/98
|
||||
[#1014]: https://github.com/spf13/hugo/issues/1014
|
||||
@@ -36,6 +36,8 @@ Feel free to [contribute][] or open a new issue if you have an idea for a new fe
|
||||
[contribute]: /contribute-to-hugo/
|
||||
[hosting and deployment]: /hosting-and-deployment/
|
||||
[existing migration tools]: /developer-tools/migrate-to-hugo/
|
||||
[open a new issue]: https://github.com/spf13/hugo/issues/
|
||||
[related Discuss thread]: https://discuss.gohugo.io/t/web-based-editor/155
|
||||
[themes]: /themes
|
||||
[tutorials]: /tutorials
|
||||
[themes]: /themes/
|
||||
[tutorials]: /tutorials
|
||||
[*your* best ideas!]: /contribute-to-hugo/
|
||||
@@ -9,6 +9,7 @@ weight: 30
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
toc: false
|
||||
notes:
|
||||
---
|
||||
|
||||
|
||||
@@ -10,5 +10,6 @@ categories: [content management]
|
||||
weight: 01
|
||||
draft: false
|
||||
aliases: [/content/]
|
||||
toc: false
|
||||
notes:
|
||||
---
|
||||
|
||||
@@ -10,10 +10,13 @@ categories: [content management]
|
||||
weight: 50
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
aliases: [/content/archetypes/]
|
||||
toc: true
|
||||
notes:
|
||||
---
|
||||
|
||||
## What are Archetypes?
|
||||
|
||||
**Archetypes** are content files in the [archetypes directory][] of your project that contain preconfigured [front matter][] for your website's [content types][]. Archetypes facilitate consistent metadata across your website content and allow content authors to quickly generate instances of a content type via the `hugo new` command.
|
||||
|
||||
Hugo's generator assumes your working directory is the content folder at the root of your project. Hugo is able to infer the appropriate archetype by assuming the content type from the content section passed to the CLI command:
|
||||
@@ -40,7 +43,7 @@ Running this command in a new site that does not have default or custom archetyp
|
||||
```toml
|
||||
+++
|
||||
date = "2017-02-01T19:20:04-07:00"
|
||||
title: my first post
|
||||
title = my first post
|
||||
+++
|
||||
```
|
||||
{{% /output %}}
|
||||
|
||||
@@ -11,6 +11,7 @@ weight: 30
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/content-management/sections,/content/sections/]
|
||||
toc: true
|
||||
notes:
|
||||
---
|
||||
|
||||
|
||||
@@ -11,5 +11,6 @@ weight: 70
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/content/summaries/]
|
||||
toc:
|
||||
notes:
|
||||
---
|
||||
@@ -11,6 +11,7 @@ weight: 40
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/content/types]
|
||||
toc: true
|
||||
notes:
|
||||
---
|
||||
|
||||
@@ -22,8 +23,7 @@ A good example of when multiple types are needed is to look at [Tumblr][]. A pie
|
||||
|
||||
Hugo assumes that your site will be organized into [sections][] and each section will use the corresponding type. If you are taking advantage of this, then each new piece of content you place into a section will automatically inherit the type.
|
||||
|
||||
Alternatively, you can set the type in the meta data under the key "`type`".
|
||||
|
||||
Alternatively, you can set the content type in a content file's metadata (i.e., [front matter][]) under the key "`type`".
|
||||
|
||||
## Creating New Content of a Specific Type
|
||||
|
||||
@@ -32,34 +32,33 @@ You can manually add files to your content directories, but Hugo has the ability
|
||||
|
||||
## Defining a content type
|
||||
|
||||
Creating a new content type is easy in Hugo. You simply provide the templates and archetype
|
||||
that the new type will use. You only need to define the templates, archetypes and/or views
|
||||
unique to that content type. Hugo will fall back to using the general templates and default archetype
|
||||
whenever a specific file is not present.
|
||||
Creating a new content type is easy in Hugo. You simply provide the templates and archetype that the new type will use. You only need to define the templates, archetypes and/or views unique to that content type. Hugo will fall back to using the general templates and default archetype whenever a specific file is not present.
|
||||
|
||||
*Remember, all of the following are optional:*
|
||||
{{% note "Declaring Content Types" %}}
|
||||
Remember, all of the following are *optional*. If you do not specifically declare content types in your front matter or develop specific layouts for content types, Hugo is smart enough to infer the content type from the file path and content section (see [content sections](/content-management/content-sections/)).
|
||||
{{% /note %}}
|
||||
|
||||
### Create Type Directory
|
||||
### Create Type Layout Directory
|
||||
|
||||
Create a directory with the name of the type in `/layouts`. Type is always singular. *E.g. `/layouts/post`*.
|
||||
Create a directory with the name of the type in `/layouts`. Type is always singular; e.g., even if your content directory is `content/posts`, create `/layouts/post/`.
|
||||
|
||||
### Create single template
|
||||
### Create a Single Template
|
||||
|
||||
Create a file called `single.html` inside your directory. *E.g. `/layouts/post/single.html`*.
|
||||
|
||||
### Create list template
|
||||
### Create a List Template
|
||||
|
||||
Create a file called `post.html` inside the section lists template directory, `/layouts/section`. *E.g. `/layouts/section/post.html`*.
|
||||
Create a file called `post.html` inside the section lists template directory, `/layouts/section`; e.g., `/layouts/section/post.html`.
|
||||
|
||||
### Create views
|
||||
|
||||
Many sites support rendering content in a few different ways, for instance, a single page view and a summary view to be used when displaying a [list of contents on a single page][]. Hugo makes no assumptions about how you want to display your content and will support as many different views of a content type as your site requires. All that is required for these additional views is that a template exists in each `/layouts/TYPE` directory with the same name.
|
||||
|
||||
### Create a corresponding archetype
|
||||
### Create A Corresponding Archetype
|
||||
|
||||
Create a file called <code><em>type</em>.md</code> in the `/archetypes` directory. *E.g. `/archetypes/post.md`*.
|
||||
Create an archetype file for your type at `yourtype.md` in the `/archetypes` directory; e.g., `/archetypes/post.md`.
|
||||
|
||||
More details about archetypes can be found at the [archetypes docs](/content/archetypes/).
|
||||
More details about archetypes can be found in the [archetypes][] documentation.
|
||||
|
||||
[archetypes]: /content-management/archetypes/
|
||||
[sections]: /content-sections/
|
||||
|
||||
@@ -11,5 +11,6 @@ weight: 80
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
toc:
|
||||
notes:
|
||||
---
|
||||
@@ -11,6 +11,7 @@ weight: 20
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/content/front-matter/]
|
||||
toc:
|
||||
notes:
|
||||
---
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ weight: 10
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/content/markdown-extras/,/content/supported-formats/,/content/markdown/]
|
||||
toc:
|
||||
notes:
|
||||
---
|
||||
|
||||
|
||||
@@ -11,5 +11,6 @@ weight: 120
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
toc:
|
||||
notes:
|
||||
---
|
||||
@@ -11,5 +11,6 @@ weight: 100
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/extras/toc/]
|
||||
toc:
|
||||
notes:
|
||||
---
|
||||
@@ -10,8 +10,193 @@ categories: [content management]
|
||||
weight: 60
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/taxonomies/overview/,/taxonomies/usage/]
|
||||
aliases: [/taxonomies/overview/,/taxonomies/usage/,/indexes/overview/,/doc/indexes/,/extras/indexes]
|
||||
toc: true
|
||||
notes:
|
||||
---
|
||||
|
||||
## Configuring Taxonomies
|
||||
## What is a Taxonomy?
|
||||
|
||||
Hugo includes support for user-defined groupings of content called **taxonomies**. Taxonomies are classifications that demonstrate logical relationships between content.
|
||||
|
||||
{{% note %}}
|
||||
Taxonomies were previously known as *indexes* in Hugo before v0.11.
|
||||
{{% /note %}}
|
||||
|
||||
### Taxonomy Definitions
|
||||
|
||||
In order to effectively work with taxonomies in Hugo, it's important to first understand the language used to described different facets of usage.
|
||||
|
||||
* **Taxonomy:** A categorization that can be used to classify content
|
||||
* **Term:** A key within that taxonomy
|
||||
* **Value:** A piece of content assigned to that Term
|
||||
|
||||
## Hugo's Default Taxonomies
|
||||
|
||||
Hugo ships with *tags* and *categories* as default taxonomies. These taxonomies are common to many website systems (e.g., WordPress, Drupal, Jekyll). Unlike these systems, Hugo makes it trivial to customize the taxonomies you will be using for your website. In addition to *tags* and *categories*, a *series* of posts for a blog is another common example of taxonomies.
|
||||
|
||||
## Pages Generated
|
||||
|
||||
When taxonomies are used---and [taxonomy templates][] are provided---Hugo will automatically create a taxonomy page listing all of the taxonomy's terms and individual pages for all content associated with the term. For example, a `categories` taxonomy will create the following pages:
|
||||
|
||||
* A single page at `yoursite.com/categories/` that lists all the [terms within the taxonomy][]
|
||||
* [Individual taxonomy list pages][] (e.g., `/categories/development/`) for each of the terms that shows a listing of all pages marked as part of that taxonomy within any content file's [front matter][]
|
||||
|
||||
## Configuring Taxonomies
|
||||
|
||||
Taxonomies must be defined in your [website configuration][] before they can be
|
||||
used throughout the site. You need to provide both the plural and
|
||||
singular labels for each taxonomy.
|
||||
|
||||
Here is an example configuration in TOML and YAML
|
||||
that specifies three taxonomies (the default two, plus `series`).
|
||||
|
||||
Notice the format is `singular key = "plural value"` for TOML and `singular key: "plural value"` for YAML:
|
||||
|
||||
### TOML Configuration
|
||||
|
||||
```toml
|
||||
[taxonomies]
|
||||
tag = "tags"
|
||||
category = "categories"
|
||||
series = "series"
|
||||
```
|
||||
|
||||
### YAML Configuration
|
||||
|
||||
```yaml
|
||||
taxonomies:
|
||||
tag: "tags"
|
||||
category: "categories"
|
||||
series: "series"
|
||||
```
|
||||
|
||||
### Preserving Taxonomy Values
|
||||
|
||||
By default, taxonomy names are hyphenated, lower-cased, normalized, and then fixed and title-ized on the archive page.
|
||||
|
||||
However, if you want to have a taxonomy value with special characters such as `Gérard Depardieu` instead of `Gerard Depardieu`, you need to set the value for `preserveTaxonomyNames` in your [site configuration](/overview/configuration/) to `true`. Hugo will then preserve special characters in taxonomy values but will still titleize the values for titles and normalize them in URLs.
|
||||
|
||||
Note that if you use `preserveTaxonomyNames` and intend to manually construct URLs to the archive pages, you will need to pass the taxonomy values through the [`urlize` template function][].
|
||||
|
||||
## Adding Taxonomies to Content
|
||||
|
||||
Once a taxonomy is defined at the site level, any piece of content can be assigned to it, regardless of [content type][] or [content section][].
|
||||
|
||||
Assigning content to a taxonomy is done in the [front matter][]. Simply create a variable with the *plural* name of the taxonomy and assign all terms you want to apply to the instance of the content type.
|
||||
|
||||
{{% note %}}
|
||||
If you would like the ability to quickly generate content files with preconfigured taxonomies or terms, read the docs on [Hugo archetypes](/content-management/archetypes/).
|
||||
{{% /note %}}
|
||||
|
||||
### TOML Front Matter Example
|
||||
|
||||
```toml
|
||||
+++
|
||||
title = "Hugo: A fast and flexible static site generator"
|
||||
tags = [ "Development", "Go", "fast", "Blogging" ]
|
||||
categories = [ "Development" ]
|
||||
series = [ "Go Web Dev" ]
|
||||
slug = "hugo"
|
||||
project_url = "https://github.com/spf13/hugo"
|
||||
+++
|
||||
```
|
||||
|
||||
### YAML Front Matter Example
|
||||
|
||||
```yaml
|
||||
+++
|
||||
title: "Hugo: A fast and flexible static site generator"
|
||||
tags: ["Development", "Go", "fast", "Blogging"]
|
||||
categories: ["Development"]
|
||||
categories: ["Go Web Dev"]
|
||||
slug: "hugo"
|
||||
project_url: "https://github.com/spf13/hugo"
|
||||
+++
|
||||
```
|
||||
|
||||
### JSON Front Matter Example
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "Hugo: A fast and flexible static site generator",
|
||||
"tags": [
|
||||
"Development",
|
||||
"Go",
|
||||
"fast",
|
||||
"Blogging"
|
||||
],
|
||||
"categories" : [
|
||||
"Development"
|
||||
],
|
||||
"series" : [
|
||||
"Go Web Dev"
|
||||
],
|
||||
"slug": "hugo",
|
||||
"project_url": "https://github.com/spf13/hugo"
|
||||
}
|
||||
```
|
||||
|
||||
## Add Content File with Front Matter
|
||||
|
||||
See [project organization][].
|
||||
|
||||
## Example Taxonomy
|
||||
|
||||
For example, if I was writing about movies, I may want the following
|
||||
taxonomies:
|
||||
|
||||
* Actors
|
||||
* Directors
|
||||
* Studios
|
||||
* Genre
|
||||
* Year
|
||||
* Awards
|
||||
|
||||
I would then specify in each movie’s front matter the specific terms for each of those taxonomies. Hugo would then automatically create pages for each Actor, Director, Studio, Genre, Year and Award listing all of the Movies that matched that specific Actor, Director, etc.
|
||||
|
||||
### Taxonomy Organization
|
||||
|
||||
Let’s use an example to demonstrate the different labels in action.
|
||||
From the perspective of the taxonomy, it could be visualized as:
|
||||
|
||||
```
|
||||
Actor <- Taxonomy
|
||||
Bruce Willis <- Term
|
||||
The Six Sense <- Content
|
||||
Unbreakable <- Content
|
||||
Moonrise Kingdom <- Content
|
||||
Samuel L. Jackson <- Term
|
||||
Unbreakable <- Content
|
||||
The Avengers <- Content
|
||||
xXx <- Content
|
||||
```
|
||||
|
||||
From the perspective of the content, it would appear differently, although the data and labels used are the same:
|
||||
|
||||
```
|
||||
Unbreakable <- Content
|
||||
Actors <- Taxonomy
|
||||
Bruce Willis <- Term
|
||||
Samuel L. Jackson <- Term
|
||||
Director <- Taxonomy
|
||||
M. Night Shyamalan <- Term
|
||||
...
|
||||
Moonrise Kingdom <- Content
|
||||
Actors <- Taxonomy
|
||||
Bruce Willis <- Term
|
||||
Bill Murray <- Term
|
||||
Director <- Taxonomy
|
||||
Wes Anderson <- Term
|
||||
...
|
||||
```
|
||||
|
||||
[`urlize` template function]: /functions/urlize/
|
||||
[content section]: /content-section/
|
||||
[content type]: /content-type/
|
||||
[front matter]: /content-management/front-matter/
|
||||
[Individual taxonomy list pages]: /templates/taxonomy-templates/#taxonomy-templates
|
||||
[project organization]: /project-organization/
|
||||
[taxonomy templates]: /templates/taxonomy-templates/
|
||||
[terms within the taxonomy]: /templates/taxonomy-templates/#terms-templates
|
||||
[website configuration]: /project-organization/configuration/
|
||||
@@ -11,6 +11,7 @@ weight: 90
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/extras/permalinks/,/extras/aliases/,/content-management/permalinks-and-redirects/,/extras/urls/]
|
||||
toc: true
|
||||
notes:
|
||||
---
|
||||
|
||||
|
||||
@@ -12,5 +12,6 @@ weight: 01
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/tutorials/how-to-contribute-to-hugo/]
|
||||
toc: false
|
||||
notes:
|
||||
---
|
||||
@@ -5,12 +5,13 @@ description: Proud of a site you built with Hugo? Add it to the Official Hugo Si
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [contribute]
|
||||
categories: [contribute to hugo]
|
||||
tags: [dev,showcase]
|
||||
weight:
|
||||
draft: false
|
||||
slug:
|
||||
aliases:
|
||||
aliases: []
|
||||
toc: false
|
||||
notes:
|
||||
---
|
||||
|
||||
@@ -70,5 +71,4 @@ Last but not least, we're ready to create a [pull request](https://github.com/sp
|
||||
|
||||
Don't forget to accept the contributor license agreement. Click on the yellow badge in the automatically added comment in the pull request.
|
||||
|
||||
|
||||
[code contribution guideline]: https://github.com/spf13/hugo#code-contribution-guideline
|
||||
@@ -5,7 +5,7 @@ description: Hugo relies heavily on the contributions of the open source communi
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [contribute]
|
||||
categories: [contribute to hugo]
|
||||
tags: [dev,open source]
|
||||
weight:
|
||||
draft: false
|
||||
|
||||
@@ -5,7 +5,7 @@ description: Documentation is an integral part of any open source project. The H
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
categories: [contribute]
|
||||
categories: [contribute to hugo]
|
||||
tags: [docs,documentation]
|
||||
weight:
|
||||
draft: false
|
||||
|
||||
@@ -10,6 +10,7 @@ weight: 40
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
toc:
|
||||
notes:
|
||||
---
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ weight: 40
|
||||
draft: false
|
||||
slug:
|
||||
aliases: [/developer-tools/migrations/,/developer-tools/migrated/]
|
||||
toc:
|
||||
notes:
|
||||
---
|
||||
|
||||
|
||||
@@ -11,5 +11,6 @@ weight: 110
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
toc:
|
||||
notes:
|
||||
---
|
||||
@@ -9,6 +9,7 @@ weight:
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
toc:
|
||||
notes:
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
title: Quick Start
|
||||
linktitle: Quick Start
|
||||
description:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
weight:
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
toc:
|
||||
notes:
|
||||
---
|
||||
|
||||
@@ -5,11 +5,11 @@ description:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: []
|
||||
categories: []
|
||||
toc: false
|
||||
weight:
|
||||
draft: false
|
||||
type:
|
||||
layout:
|
||||
slug:
|
||||
aliases: []
|
||||
notes:
|
||||
---
|
||||
@@ -5,8 +5,9 @@ description:
|
||||
date: 2017-02-01
|
||||
publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
tags: [wercker]
|
||||
weight:
|
||||
tags: []
|
||||
categories: []
|
||||
toc: false
|
||||
draft: false
|
||||
slug:
|
||||
aliases: []
|
||||
|
||||
@@ -7,9 +7,9 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
weight:
|
||||
draft: false
|
||||
type:
|
||||
layout:
|
||||
slug:
|
||||
tags: []
|
||||
categories: []
|
||||
toc: false
|
||||
aliases: []
|
||||
notes:
|
||||
---
|
||||
@@ -7,9 +7,9 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
weight:
|
||||
draft: false
|
||||
type:
|
||||
layout:
|
||||
slug:
|
||||
tags: []
|
||||
categories: []
|
||||
toc: false
|
||||
aliases: []
|
||||
notes:
|
||||
---
|
||||
@@ -7,9 +7,9 @@ publishdate: 2017-02-01
|
||||
lastmod: 2017-02-01
|
||||
weight:
|
||||
draft: false
|
||||
type:
|
||||
layout:
|
||||
slug:
|
||||
tags: []
|
||||
categories: []
|
||||
toc: false
|
||||
aliases: []
|
||||
notes:
|
||||
---
|
||||
@@ -3,7 +3,7 @@ title: Configuration
|
||||
linktitle:
|
||||
description: Scaffolding new projects, configuration, and source organization.
|
||||
date: 2017-01-02
|
||||
tags: [configuration,fundamentals]
|
||||
tags: [configuration,fundamentals,toml,yaml,json]
|
||||
publishdate: 2017-01-02
|
||||
lastmod: 2017-01-02
|
||||
weight: 10
|
||||
@@ -15,7 +15,9 @@ notes:
|
||||
|
||||
The [directory structure][] of a Hugo website—or more precisely, the source organization of files containing the website's content and templates—provides most of the configuration information that Hugo needs in order to statically generate a finished website.
|
||||
|
||||
Therefore, many websites wouldn't actually need a configuration file. This is because Hugo is designed to recognize certain typical usage patterns (and expects them, by default).
|
||||
Therefore, many websites may not need a configuration file. Hugo is designed to recognize certain typical usage patterns (and expects them, by default).
|
||||
|
||||
## Configuration Lookup Order
|
||||
|
||||
Nevertheless, Hugo searches for a configuration file in the root of your website's source directory as a default behavior. First, it looks for a `./config.toml` file. If that's not present, it will seek a `./config.yaml` file,
|
||||
followed by a `./config.json` file.
|
||||
@@ -46,29 +48,7 @@ params:
|
||||
```
|
||||
{{% /input %}}
|
||||
|
||||
## TOML Configuration
|
||||
|
||||
The following is an example of a TOML configuration file. The values under `[params]` will populate the `.Site.Params` variable for use in [templates][]:
|
||||
|
||||
```toml
|
||||
contentDir = "content"
|
||||
layoutDir = "layouts"
|
||||
publishDir = "public"
|
||||
buildDrafts = false
|
||||
baseURL = "https://yoursite.example.com/"
|
||||
canonifyURLs = true
|
||||
title = "My Hugo Site"
|
||||
|
||||
[taxonomies]
|
||||
category = "categories"
|
||||
tag = "tags"
|
||||
|
||||
[params]
|
||||
subtitle = "Hugo is Absurdly Fast!"
|
||||
author = "John Doe"
|
||||
```
|
||||
|
||||
## All Variables, YAML
|
||||
### All Variables, YAML
|
||||
|
||||
The following is the full list of Hugo-defined variables in an example YAML file. The values provided in this example represent the default values used by Hugo.
|
||||
|
||||
@@ -181,7 +161,29 @@ taxonomies:
|
||||
```
|
||||
{{% /input %}}
|
||||
|
||||
## All Variables, TOML
|
||||
## TOML Configuration
|
||||
|
||||
The following is an example of a TOML configuration file. The values under `[params]` will populate the `.Site.Params` variable for use in [templates][]:
|
||||
|
||||
```toml
|
||||
contentDir = "content"
|
||||
layoutDir = "layouts"
|
||||
publishDir = "public"
|
||||
buildDrafts = false
|
||||
baseURL = "https://yoursite.example.com/"
|
||||
canonifyURLs = true
|
||||
title = "My Hugo Site"
|
||||
|
||||
[taxonomies]
|
||||
category = "categories"
|
||||
tag = "tags"
|
||||
|
||||
[params]
|
||||
subtitle = "Hugo is Absurdly Fast!"
|
||||
author = "John Doe"
|
||||
```
|
||||
|
||||
### All Variables, TOML
|
||||
|
||||
The following is the full list of Hugo-defined variables in an example TOML file. The values provided in this example represent the default values used by Hugo.
|
||||
|
||||
@@ -305,7 +307,7 @@ $ env HUGO_TITLE="Some Title" hugo
|
||||
```
|
||||
|
||||
{{% note "Setting Environment Variables" %}}
|
||||
names must be prefixed with `HUGO_` when setting environment variables through operating system environment variables.
|
||||
Names must be prefixed with `HUGO_` when setting environment variables through operating system environment variables.
|
||||
{{% /note %}}
|
||||
|
||||
## Ignoring Files When Rendering
|
||||
@@ -318,7 +320,7 @@ ignoreFiles = [ "\\.foo$", "\\.boo$" ]
|
||||
```
|
||||
The above is a list of regular expressions. Note that the backslash (`\`) character is escaped in this example to keep TOML happy.
|
||||
|
||||
## Additional Resources
|
||||
## Configuration Format Specs
|
||||
|
||||
* [TOML Spec][]
|
||||
* [YAML Spec][]
|
||||
|
||||
@@ -6,7 +6,7 @@ date: 2017-01-02
|
||||
publishdate: 2017-01-02
|
||||
lastmod: 2017-01-02
|
||||
categories: [project organization]
|
||||
tags: [source, organization, directories]
|
||||
tags: [source, organization, directories,fundamentals]
|
||||
weight: 10
|
||||
draft: false
|
||||
slug:
|
||||
|
||||
@@ -14,4 +14,9 @@ aliases: []
|
||||
notes:
|
||||
---
|
||||
|
||||
## Configuring Taxonomies
|
||||
## Configuring Taxonomies
|
||||
|
||||
## Taxonomy Templates
|
||||
|
||||
## Terms Templates
|
||||
|
||||
|
||||
@@ -1,2 +1,14 @@
|
||||
---
|
||||
linktitle:
|
||||
description: ""
|
||||
publishdate: ""
|
||||
lastmod: ""
|
||||
categories: []
|
||||
tags: []
|
||||
weight: 00
|
||||
draft: true
|
||||
slug: ""
|
||||
aliases: []
|
||||
toc: false
|
||||
notes: Categories are not required metadata as of February 2017.
|
||||
---
|
||||
@@ -1,8 +1,13 @@
|
||||
+++
|
||||
subtitle = ""
|
||||
author = ""
|
||||
publishdate = ""
|
||||
description = ""
|
||||
tags = ""
|
||||
categories = ""
|
||||
+++
|
||||
---
|
||||
linktitle: ""
|
||||
expirydate: ""
|
||||
publishdate: ""
|
||||
lastmod: ""
|
||||
description: ""
|
||||
draft: false
|
||||
tags: []
|
||||
categories: ["functions"]
|
||||
aliases: []
|
||||
toc: false
|
||||
notes: Some notes on this function.
|
||||
---
|
||||
@@ -1,11 +1,11 @@
|
||||
---
|
||||
date:
|
||||
description: ""
|
||||
lastmod: ""
|
||||
license: ""
|
||||
licenseLink: ""
|
||||
sitelink: ""
|
||||
sourceLink: ""
|
||||
tags: []
|
||||
thumbnail: ""
|
||||
title:
|
||||
---
|
||||
thumbnail: "/images/yourthumb-tn.jpg"
|
||||
toc: false
|
||||
---
|
||||
@@ -1,14 +1,14 @@
|
||||
{{$kind := .Kind}}
|
||||
{{if eq $kind "section"}}
|
||||
<h2 class="section-heading">{{replace (replace .Section "-" " " | title) "And" "and"}} Contents:</h2>
|
||||
<h2 class="section-heading">Section Contents:</h2>
|
||||
{{end}}
|
||||
{{range .Data.Pages}}
|
||||
<article class="contents-list {{$kind}}">
|
||||
<header>
|
||||
<a href="{{.Permalink}}"><h3>{{.Title}}</h3></a>
|
||||
<div class="contents-list-image-wrapper">
|
||||
<img src="{{.Site.BaseURL}}images/{{.Section}}.svg" alt="">
|
||||
</div>
|
||||
<a href="{{.Permalink}}"><h3>{{.Title}}</h3></a>
|
||||
</header>
|
||||
<p>{{.Description}}</p>
|
||||
</article>
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
<script src="{{.Site.BaseURL}}js/vendor/jquery-2.2.4.min.js"></script>
|
||||
<script src="/js/script.min.js" async></script>
|
||||
<script src="{{.Site.BaseURL}}js/script.min.js"></script>
|
||||
{{ if ne .Params.toc "false" }}
|
||||
<script src="{{.Site.BaseURL}}js/vendor/scrollspy.min.js"></script>
|
||||
<script async defer src="{{.Site.BaseURL}}js/table-of-contents.js"></script>
|
||||
{{ end }}
|
||||
|
||||
{{$gaid := .Site.Params.googleanalyticstrackingcode }}
|
||||
<!-- Place this tag in your head or just before your close body tag. -->
|
||||
<!-- GitHub Buttons -->
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
<!-- Google Analytics -->
|
||||
<script>
|
||||
(function() {
|
||||
if (window.location.hostname === "localhost") {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{{if ne .Params.toc false}}
|
||||
<aside id="toc">
|
||||
<header>
|
||||
<a href="#page-top">
|
||||
@@ -6,4 +7,5 @@
|
||||
</header>
|
||||
{{.TableOfContents}}
|
||||
</aside>
|
||||
<a href="#" id="toc-toggle"></a>
|
||||
<a href="#" id="toc-toggle"></a>
|
||||
{{end}}
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="note">
|
||||
<h2>{{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Note{{end}}</h2>
|
||||
<h2 id="{{if .Get 0}}{{.Get 0 | urlize}}{{else}}note{{end}}">{{if .Get 0}}{{.Get 0 | markdownify}}{{else}}Note{{end}}</h2>
|
||||
<div class="shortcode-content">
|
||||
{{.Inner}}
|
||||
</div>
|
||||
|
||||
@@ -16,5 +16,3 @@ $(document).ready(function() {
|
||||
location.hash = hashid;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ $base-button-text-color: $hugo-white;
|
||||
$button-border-radius: .25em;
|
||||
|
||||
//Codeblocks
|
||||
$code-font-family:'courierprime',courier,monospace;
|
||||
$code-font-family:'sourcecodepro',courier,monospace;
|
||||
$code-tooltip-bg-color: $hugo-pink;
|
||||
$code-block-base-font-color: #ffffff;
|
||||
$code-block-background-color: $hugo-black;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@include fonts('muli', $weights: 100 300 400 600 700);
|
||||
@include fonts('courierprime', $weights: 400 700);
|
||||
@include fonts('sourcecodepro', $weights: 400 700);
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
@@ -14,16 +14,16 @@ h1.page-title {
|
||||
font-size: 1.8em;
|
||||
letter-spacing: -.021em;
|
||||
padding-bottom: 0px;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
@include MQ(M) {
|
||||
padding-top: 0px;
|
||||
}
|
||||
img {
|
||||
display:inline;
|
||||
display: inline;
|
||||
@include size(1em);
|
||||
margin-right:.15em;
|
||||
margin-right: .15em;
|
||||
}
|
||||
i[class^="icon-"] {
|
||||
margin-left: -.15em;
|
||||
@@ -62,4 +62,4 @@ h4 {
|
||||
a.submenu-item-link.functions {
|
||||
font-family: $base-font-family;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,13 @@ a {
|
||||
.body-copy {
|
||||
li,
|
||||
p {
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
a {
|
||||
z-index:1;
|
||||
color:$default-anchor-underline-color;
|
||||
&:hover {
|
||||
// text-decoration: underline!important;
|
||||
border-bottom:1px solid $default-anchor-underline-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,8 +48,8 @@ a.tooltip {
|
||||
}
|
||||
&.tooltip-right {
|
||||
&:hover::before {
|
||||
left:0px;
|
||||
right:auto;
|
||||
left: 0px;
|
||||
right: auto;
|
||||
}
|
||||
}
|
||||
&.edit-link:hover {
|
||||
|
||||
@@ -3,7 +3,7 @@ code,
|
||||
pre {
|
||||
font-family: $code-font-family;
|
||||
margin: 0px;
|
||||
color:$code-base-font-color;
|
||||
color: $code-base-font-color;
|
||||
}
|
||||
|
||||
.body-copy > pre {
|
||||
@@ -17,24 +17,41 @@ pre {
|
||||
.body-copy {
|
||||
p {
|
||||
code {
|
||||
display:inline-block;
|
||||
padding-top:.15em;
|
||||
display: inline-block;
|
||||
padding-top: .15em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p code,
|
||||
li code,
|
||||
td code {
|
||||
font-size: .9em;
|
||||
color: $inline-code-text-color;
|
||||
font-family: $code-font-family;
|
||||
// border: 1px solid $hugo-gray-light;
|
||||
padding-left: .25em;
|
||||
padding-right: .25em;
|
||||
background-color: $inline-code-background-color;
|
||||
border:none;
|
||||
outline:none;
|
||||
.body-copy {
|
||||
code,
|
||||
p code,
|
||||
td code {
|
||||
font-size: .85em;
|
||||
display:inline-block;
|
||||
color: $inline-code-text-color;
|
||||
font-family: $code-font-family;
|
||||
padding-left: .25em;
|
||||
padding-right: .25em;
|
||||
padding-bottom:.1em;
|
||||
line-height:1.2;
|
||||
margin-bottom:.15em;
|
||||
margin-top:0px;
|
||||
padding-top:0px;
|
||||
// line-height:1;
|
||||
vertical-align:middle;
|
||||
//darken code background color for non-retina screens
|
||||
background-color: darken($inline-code-background-color,5%);
|
||||
border: none;
|
||||
outline: none;
|
||||
z-index:-1;
|
||||
@include MQ(retina){
|
||||
background-color: $inline-code-background-color;
|
||||
}
|
||||
}
|
||||
p > a code, li > a code, td > a code {
|
||||
color:$hugo-pink;
|
||||
}
|
||||
}
|
||||
|
||||
//for clipboard.js tooltip and button
|
||||
@@ -335,4 +352,4 @@ div.code-copy-header {
|
||||
.tooltipped-multiline.tooltipped-w:after,
|
||||
.tooltipped-multiline.tooltipped-e:after {
|
||||
right: 100%
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
h3 {
|
||||
padding-bottom: 2px;
|
||||
border-bottom: 2px solid $base-font-color;
|
||||
padding-left:1.5em;
|
||||
}
|
||||
p {
|
||||
margin-bottom: 0px;
|
||||
@@ -35,7 +36,7 @@
|
||||
max-width: 30px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
left: 0px;
|
||||
img {
|
||||
max-width: 1.5em;
|
||||
min-width: 1.5em;
|
||||
|
||||
@@ -8,6 +8,7 @@ aside {
|
||||
list-style: none;
|
||||
text-indent: 0px;
|
||||
li {
|
||||
position:relative;
|
||||
margin-left: 0px;
|
||||
padding-left: 0px;
|
||||
list-style: none;
|
||||
@@ -25,6 +26,8 @@ aside {
|
||||
padding-top: 0px;
|
||||
margin-bottom: 1.5em;
|
||||
li {
|
||||
position:relative;
|
||||
margin-top:.25em;
|
||||
ul,ol {
|
||||
margin-bottom:0px;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ aside#toc {
|
||||
padding: .5em;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
height:auto;
|
||||
@include card(1);
|
||||
z-index: 30;
|
||||
background-color: $toc-bg-color;
|
||||
@@ -17,43 +18,111 @@ aside#toc {
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
}
|
||||
nav {
|
||||
float: left;
|
||||
overflow-y: scroll;
|
||||
ul {
|
||||
margin-top: .5em;
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
ul li ul {
|
||||
font-size: 15px;
|
||||
li {
|
||||
margin-top: .5em;
|
||||
a {
|
||||
color: lighten($base-font-color, 25%);
|
||||
}
|
||||
ul {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
h3 {
|
||||
margin-bottom: 0px;
|
||||
margin-left: 8px;
|
||||
padding-bottom: 0px;
|
||||
border-bottom: 1px solid $base-font-color;
|
||||
color: $base-font-color;
|
||||
font-size:17px;
|
||||
font-size: 17px;
|
||||
}
|
||||
@include MQ(XL) {
|
||||
box-shadow: none;
|
||||
top: $site-header-height + 20px;
|
||||
left: calc(#{$site-navigation-width} + #{$content-max-width} + 48px);
|
||||
bottom:auto;
|
||||
bottom: auto;
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
nav#TableOfContents {
|
||||
float: left;
|
||||
position:relative;
|
||||
overflow-y: scroll;
|
||||
> ul:first-child {
|
||||
padding-left: 0px;
|
||||
margin-left: 0px;
|
||||
margin-top: .5em;
|
||||
margin-bottom: .5em;
|
||||
> li {
|
||||
padding-left: 0px;
|
||||
margin-left: 0px;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
ul > li > ul {
|
||||
li {
|
||||
line-height: 1.2;
|
||||
font-size: .85em;
|
||||
padding-left: 8px;
|
||||
position: relative;
|
||||
margin-top: .5em;
|
||||
margin-bottom: .5em;
|
||||
a {
|
||||
color: $base-font-color;
|
||||
position: relative;
|
||||
&:hover {
|
||||
color: $hugo-pink;
|
||||
&::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
border-left: 1px solid $hugo-pink;
|
||||
position: absolute;
|
||||
left: -8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.active {
|
||||
> a {
|
||||
position: relative;
|
||||
color: $hugo-pink;
|
||||
font-weight: 400;
|
||||
&::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
border-left: 2px solid $hugo-pink;
|
||||
position: absolute;
|
||||
left: -8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
> ul {
|
||||
display: block;
|
||||
margin-top: 8px;
|
||||
margin-bottom: 0px;
|
||||
> li {
|
||||
a {
|
||||
&:hover {
|
||||
color: $hugo-blue;
|
||||
&::before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
border-left: 1px solid $hugo-blue;
|
||||
position: absolute;
|
||||
left: -16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&.active {
|
||||
> a {
|
||||
color: $hugo-blue;
|
||||
font-weight: 400;
|
||||
&::before {
|
||||
border-left: 2px solid $hugo-blue;
|
||||
left: -16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a#toc-toggle {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -113,4 +113,7 @@ header.content-header {
|
||||
div + h2 {
|
||||
margin-top: 1em;
|
||||
}
|
||||
em {
|
||||
font-weight:bolder;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,48 @@
|
||||
$(document).ready(function() {
|
||||
// Cache selectors
|
||||
var lastId,
|
||||
tocNav = $("#TableOfContents"),
|
||||
tocNavHeight = tocNav.outerHeight() + 15,
|
||||
headerHeight = $('#site-header').height(),
|
||||
// All list items
|
||||
menuItems = tocNav.find("a"),
|
||||
// Anchors corresponding to menu items
|
||||
scrollItems = menuItems.map(function() {
|
||||
var item = $($(this).attr("href"));
|
||||
if (item.length) {
|
||||
return item;
|
||||
}
|
||||
});
|
||||
console.log(tocNavHeight);
|
||||
|
||||
// Bind to scroll
|
||||
$(window).scroll(function() {
|
||||
// Get container scroll position
|
||||
var fromTop = $(this).scrollTop() + headerHeight + 30;
|
||||
console.log("fromTop = " + fromTop);
|
||||
|
||||
// Get id of current scroll item
|
||||
var cur = scrollItems.map(function() {
|
||||
if ($(this).offset().top < fromTop)
|
||||
return this;
|
||||
});
|
||||
// Get the id of the current element
|
||||
cur = cur[cur.length - 1];
|
||||
var id = cur && cur.length ? cur[0].id : "";
|
||||
var isBottom = $(window).scrollTop() + $(window).height() == $(document).height();
|
||||
|
||||
if (lastId !== id) {
|
||||
lastId = id;
|
||||
// Set/remove active class
|
||||
menuItems
|
||||
.parent().removeClass("active")
|
||||
.end().filter("[href='#" + id + "']").parent().addClass("active");
|
||||
}
|
||||
if (isBottom) {
|
||||
menuItems.parent().removeClass('active');
|
||||
if (menuItems.last().parent().attr('class') !== 'active') {
|
||||
menuItems.last().parent().addClass('active');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
!function(e,n){function o(e){return"object"===n.type(e)}function i(e){return"string"===n.type(e)&&n.trim(e).length>0}function t(e,n,o,i){i(e[o])||(e[o]=n[o])}n.fn.extend({scrollspy:function(l,s){if(i(l)){var a=s;s=l,l=a}l=n.extend({},r,l),t(l,r,"container",o);var c=n(l.container);if(0===c.length)return this;if(t(l,r,"namespace",i),i(s)&&"DESTROY"===s.toUpperCase())return c.off("scroll."+l.namespace),this;t(l,r,"buffer",n.isNumeric),t(l,r,"max",n.isNumeric),t(l,r,"min",n.isNumeric),t(l,r,"onEnter",n.isFunction),t(l,r,"onLeave",n.isFunction),t(l,r,"onLeaveTop",n.isFunction),t(l,r,"onLeaveBottom",n.isFunction),t(l,r,"onTick",n.isFunction),n.isFunction(l.max)&&(l.max=l.max()),n.isFunction(l.min)&&(l.min=l.min());var u="VERTICAL"===e.String(l.mode).toUpperCase();return this.each(function(){var e=this,o=n(e),i=0,t=!1,r=0;c.on("scroll."+l.namespace,function(){var s=n(this),a={top:s.scrollTop(),left:s.scrollLeft()},f=c.height(),p=l.max,m=l.min,v=u?a.top+l.buffer:a.left+l.buffer;if(0===p&&(p=u?f:c.outerWidth()+o.outerWidth()),v>=m&&p>=v)t||(t=!0,i++,o.trigger("scrollEnter",{position:a}),null!==l.onEnter&&l.onEnter(e,a)),o.trigger("scrollTick",{position:a,inside:t,enters:i,leaves:r}),null!==l.onTick&&l.onTick(e,a,t,i,r);else if(t)t=!1,r++,o.trigger("scrollLeave",{position:a,leaves:r}),null!==l.onLeave&&l.onLeave(e,a),m>=v?(o.trigger("scrollLeaveTop",{position:a,leaves:r}),null!==l.onLeaveTop&&l.onLeaveTop(e,a)):v>=p&&(o.trigger("scrollLeaveBottom",{position:a,leaves:r}),null!==l.onLeaveBottom&&l.onLeaveBottom(e,a));else{var g=c.scrollTop(),L=o.height(),h=o.offset().top;f+g>h&&h>g-L&&(o.trigger("scrollView",{position:a}),null!==l.onView&&l.onView(e,a))}})})}});var r={buffer:0,container:e,max:0,min:0,mode:"vertical",namespace:"scrollspy",onEnter:null,onLeave:null,onLeaveTop:null,onLeaveBottom:null,onTick:null,onView:null}}(window,window.jQuery);
|
||||
Reference in New Issue
Block a user