Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.11.x #1509

Closed
wants to merge 26 commits into from
Closed

V0.11.x #1509

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b45d604
setting version number
spf13 Jun 3, 2014
bed81e5
Add empty line to correctly render a list
hamoid Jun 3, 2014
4670706
fixed #303. Adding theme support to views
spf13 Jun 3, 2014
9e9dcdf
Adding proper error message when view is not found.. fixing #303
spf13 Jun 4, 2014
cc63e2d
fixing typo in docs
spf13 Jun 18, 2014
42f748d
Fix #263, document HTML comments & IE conditionals
Jun 5, 2014
06cb312
Included instructions for omitting disqus comments on localhost.
mdwhatcott Jun 6, 2014
97c050d
do not use angle brackets in hyperlink labels
Jun 9, 2014
48d64b1
Fix minor typo in file docs/content/templates/overview.md
rolpereira Jun 20, 2014
8c0afea
taxonomies -> Taxonomies
mhe Jun 21, 2014
74d8d76
fix link to template primer
ginabythebay Jun 22, 2014
31cb224
Getting rid of bad scrollbar
spf13 Jul 1, 2014
9fb3b2b
Fixed #328. Config file set appropriately.
spf13 Jul 1, 2014
25c7ffc
make type-or-section more obvious
natefinch Aug 3, 2014
8acf54b
update docs for permalinks with all fields
natefinch Aug 2, 2014
bb88865
it's/its
kevinburke Jul 27, 2014
1dab410
Update press.md
GraemeCaldwell Aug 5, 2014
3a3e79b
Fix #363 - Docs: make the fixed menu on the left scrollable
roperzh Aug 9, 2014
58577e2
Docs-removed bullet and broken link for catagetories. Included categ…
dkebler Aug 9, 2014
3416d8f
Adding more press
spf13 Aug 10, 2014
fcf5804
hugo builds no site if there are only drafts
franklinwise Aug 10, 2014
0937ef3
Fix #394 - Docs: add a missing link to the livereload page in the intro
roperzh Aug 15, 2014
2f171f3
Config changes and Live Reload
rahul286 Aug 15, 2014
b8c708f
Added yaml menu example
rahul286 Aug 15, 2014
7559abb
switch to new location of goyaml
adg Aug 18, 2014
b3240db
Added a note after the script adding potential issues per @franklinwi…
franklinwise Aug 10, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commands/hugo.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func init() {
}

func InitializeConfig() {
viper.SetConfigName(CfgFile)
viper.SetConfigFile(CfgFile)
viper.AddConfigPath(Source)
err := viper.ReadInConfig()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions commands/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ var disableLiveReload bool

var serverCmd = &cobra.Command{
Use: "server",
Short: "Hugo runs it's own a webserver to render the files",
Long: `Hugo is able to run it's own high performance web server.
Short: "Hugo runs its own webserver to render the files",
Long: `Hugo is able to run its own high performance web server.
Hugo will render all the files defined in the source directory and
Serve them up.`,
//Run: server,
Expand Down
2 changes: 1 addition & 1 deletion commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ var version = &cobra.Command{
Short: "Print the version number of Hugo",
Long: `All software has versions. This is Hugo's`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Hugo Static Site Generator v0.11")
fmt.Println("Hugo Static Site Generator v0.11.1")
},
}
4 changes: 4 additions & 0 deletions docs/content/community/press.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Hugo has been featured in the following Blog Posts, Press and Media.

| Title | Author | Date |
| ------ | ------ | -----: |
| [Hugo: Beyond the Defaults](http://npf.io/2014/08/hugo-beyond-the-defaults/) | Nate Finch | Aug 8 2014 |
| [Hugo Is Friggin' Awesome](http://npf.io/2014/08/hugo-is-awesome/) | Nate Finch | Aug 1 2014 |
| [An Introduction To Hugo, A Go-Based Static Site Generator](http://www.cirrushosting.com/web-hosting-blog/an-introduction-to-hugo/) | Dan Silber | July 1 2014 |
| [Mission Not Accomplished](http://johnsto.co.uk/blog/mission-not-accomplished/) | Dave Johnston | 3 Apr 2014 |
| [Hugo - A Static Site Builder in Go](http://deepfriedcode.com/post/hugo/) | Deep Fried Code | 30 Mar 2014 |
| [Hugo](http://bra.am/post/hugo/) | bra.am | 23 Mar 2014 |
| [Converting Blogger To Markdown](http://trishagee.github.io/project/atom-to-hugo/) | Trisha Gee | 20 Mar 2014 |
Expand Down
32 changes: 32 additions & 0 deletions docs/content/extras/comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,38 @@ for a given piece of content
* **disqus_title**
* **disqus_url**


## Conditional Loading of Disqus Comments

Users have noticed that enabling disqus comments when running the hugo web server on localhost causes the creation of unwanted discussions on the associated disqus account. In order to prevent this, a slightly tweaked partial template is required. So, rather than using the built-in `"_internal/disqus.html"` template referenced above, create a template in your `partials` folder that looks like this:

```javascript
<div id="disqus_thread"></div>
<script type="text/javascript">

(function() {
// Don't ever inject disqus on localhost--it creates unwanted
// discussions from 'localhost:1313' on your disqus account...
if (window.location.hostname == "localhost")
return;

var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
var disqus_shortname = '{{ .Site.Params.disqusShortname }}';
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
```

Notice that there is a simple if statement that detects when you are running on localhost and skips the initialization of the disqus comment injection.

Now reference the partial template from your page template:

{{ template "partials/disqus.html" . }}


# Alternatives

A few alternatives exist to Disqus.
Expand Down
16 changes: 15 additions & 1 deletion docs/content/extras/menus.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ available.
## Adding (non-content) entries to a menu

You can also add entries to menus that aren’t attached to a piece of
content. This takes place in the site wide config file.
content. This takes place in the site wide [config file](http://hugo.spf13.com/overview/configuration).

Here’s an example (in toml):

Expand All @@ -101,6 +101,20 @@ Here’s an example (in toml):
pre = "<i class='fa fa-road'></i>"
weight = -100

Here’s an example (in yaml):

---
menu:
main:
- Name: "about hugo"
Pre: "<i class='fa fa-heart'></i>"
Weight: -110
Identifier: "about"
- Name: "getting started"
Pre: "<i class='fa fa-road'></i>"
Weight: -100
---

## Nesting

All nesting of content is done via the `parent` field.
Expand Down
15 changes: 15 additions & 0 deletions docs/content/extras/permalinks.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,18 @@ A file named `content/post/sample-entry` which contains a line
appearing at `public/2013/11/sample-entry/index.html` and be reachable via
the URL <http://yoursite.example.com/2013/11/sample-entry/>.

The following is a list of values that can be used in a permalink definition,
all references to time are dependent on the content's date.

**:year** the 4 digit year<br/>
**:month** the 2 digit month<br/>
**:monthname** the name of the month<br/>
**:day** the 2 digit day<br/>
**:weekday** the 1 digit day of the week (Sunday = 0)<br/>
**:weekdayname** the name of the day of the week<br/>
**:yearday** the 1-3 digit day of the year<br/>
**:section** the content's section<br/>
**:title** the content's title<br/>
**:slug** the content's slug (or title if no slug)<br/>
**:filename** the content's filename (without extension)<br/>

5 changes: 5 additions & 0 deletions docs/content/overview/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ Here is a yaml configuration file which sets a few more options
SidebarRecentLimit: 5
...

## Notes

Config changes do not reflect with [Live Reload](http://hugo.spf13.com/extras/livereload)

Please restart `hugo server --watch` whenever you make a config change.
5 changes: 2 additions & 3 deletions docs/content/overview/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Hugo boasts the following features:
* Extremely fast built times (~1ms per page)
* Completely cross platform: Runs on Mac OSX, Linux and Windows
* Easy [installation](/overview/installing)
* Render changes [on the fly](/overview/usage) with [live reload](#) as you develop
* Render changes [on the fly](/overview/usage) with [live reload](/extras/livereload) as you develop
* Complete theme support
* Host your site anywhere

Expand All @@ -51,8 +51,7 @@ Hugo boasts the following features:
* Straightforward [organization](/content/organization)
* Support for [website sections](/content/sections)
* Completely customizable [urls](/extras/urls)
* Support for [categories](/indexes/category) and tags
* Support for configurable [taxonomies](/indexes/overview) to create your own organization
* Support for configurable [taxonomies](/indexes/overview) which includes categories and tags. Create your own custom organization of content
* Ability to [sort content](/content/ordering) as you desire
* Automatic [table of contents](/extras/toc) generation
* Dynamic menu creation
Expand Down
1 change: 1 addition & 0 deletions docs/content/overview/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ your content
Press ctrl+c to stop

We specified two options here.

* --theme to pick which theme.
* --buildDrafts because we want to display our content, both set to draft status

Expand Down
2 changes: 1 addition & 1 deletion docs/content/taxonomies/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Notice the format is **singular key** : *plural value*.
### config.yaml

---
taxonomies:
Taxonomies:
tag: "tags"
category: "categories"
series: "series"
Expand Down
8 changes: 4 additions & 4 deletions docs/content/templates/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ it will be used instead of `section`.

### Single

* /layouts/`TYPE` or `SECTION`/`LAYOUT`.html
* /layouts/`TYPE` or `SECTION`/single.html
* /layouts/`TYPE`-or-`SECTION`/`LAYOUT`.html
* /layouts/`TYPE`-or-`SECTION`/single.html
* /layouts/\_default/single.html
* /themes/`THEME`/layouts/`TYPE` or `SECTION`/`LAYOUT`.html
* /themes/`THEME`/layouts/`TYPE` or `SECTION`/single.html
* /themes/`THEME`/layouts/`TYPE`-or-`SECTION`/`LAYOUT`.html
* /themes/`THEME`/layouts/`TYPE`-or-`SECTION`/single.html
* /themes/`THEME`/layouts/\_default/single.html

## Example Single Template File
Expand Down
12 changes: 10 additions & 2 deletions docs/content/templates/go-templates.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
aliases:
- /layout/go-templates/
- /layouts/go-templates/
date: 2013-07-01
menu:
main:
Expand Down Expand Up @@ -220,6 +221,13 @@ Could be rewritten as
Stuff Here
{{ end }}

### Internet Explorer conditional comments using Pipes

By default Go Templates remove HTML comments from output. This has the unfortunate side effect of removing Internet Explorer conditional comments. As a workaround, use something like this:

{{ "<!--[if lt IE 9]>" | safeHtml }}
<script src="html5shiv.js"></script>
{{ "<![endif]-->" | safeHtml }}

## Context (aka. the dot)

Expand Down Expand Up @@ -335,5 +343,5 @@ so, such as in this example:
```


[go]: <http://golang.org/>
[gohtmltemplate]: <http://golang.org/pkg/html/template/>
[go]: http://golang.org/
[gohtmltemplate]: http://golang.org/pkg/html/template/
2 changes: 1 addition & 1 deletion docs/content/templates/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Different ways of rendering a (single) content type
### [Taxonomy Terms](/templates/terms)
A list of the terms used for a specific taxonomy eg. a Tag cloud

## Other Templates (generally unncessary)
## Other Templates (generally unnecessary)

### [RSS](/templates/rss/)
Used to render all rss documents
Expand Down
2 changes: 1 addition & 1 deletion docs/content/themes/creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using the `hugo new` command.

This command will initialize all of the files and directories a basic theme
would need. Hugo themes are written in the go template language. If you are new
to Go, the [go template primer](/templates/primer/) will help you get started.
to Go, the [go template primer](/layout/go-templates/) will help you get started.

## Theme Components

Expand Down
2 changes: 1 addition & 1 deletion docs/content/themes/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ site.
Hugo themes have been designed to be the perfect balance between
simplicity and functionality. Hugo themes are powered by the excellent
go template library. If you are new to go templates, see our [primer on
go templates](/layouts/go-templates).
go templates](/templates/go-templates).

Hugo themes support all modern features you come to expect. They are
structured in such a way to eliminate code duplication. Themes are also
Expand Down
25 changes: 20 additions & 5 deletions docs/content/tutorials/github_pages_blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ To get this properly set up we will execute a series of commands at the terminal
# Pull down the file we just committed. This helps avoid merge conflicts
git subtree pull --prefix=public

# Run hugo. Generated site will be placed in public directory
hugo
# Run hugo. Generated site will be placed in public directory (or omit -t ThemeName if you're not using a theme)
hugo -t ThemeName


# Add everything
git add -A
Expand All @@ -156,15 +157,29 @@ Now, as you add new posts to your blog, you will follow steps that look somethin
* Push the `master` branch
* Push the public subtree to the remote `gh-pages` branch

The first two items in the previous list are simply a way to conveniently preview your content as you write. This is a dynamic and fairly streamlined process. All the remaining items, however, are the same every time you want to add new content to the website. To make this repetitive process easier, I have adapted a script from the source repository for the [Chimer Arta & Maker Space](https://github.com/chimera/chimeraarts.org) website that is highlighted in the [Hugo Showcase](/showcase). The script lives in a file called `deploy.sh` and has the following contents
The first two items in the previous list are simply a way to conveniently preview your content as you write. This is a dynamic and fairly streamlined process. All the remaining items, however, are the same every time you want to add new content to the website. To make this repetitive process easier, I have adapted a script from the source repository for the [Chimer Arta & Maker Space](https://github.com/chimera/chimeraarts.org) website that is highlighted in the [Hugo Showcase](/showcase). The script lives in a file called `deploy.sh` and has the following contents:

**Note:**

The first command `hugo` assumes you are running with all the default settings.

To use a theme, make sure to specify it with `-t ThemeName` instead (or include the theme in the config file).

hugo -t ThemeName

To build all draft posts *(If you only have drafts, no site will be generated)*

hugo --buildDrafts

**Deploy.sh:**

#!/bin/bash

echo -e "\033[0;32mDeploying updates to Github...\033[0m"

# Build the project.
# Build the project.
hugo

# Add changes to git.
git add -A

Expand Down
2 changes: 0 additions & 2 deletions docs/layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
<!-- javascripts -->
<script src="/js/jquery.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/jquery.scrollTo.min.js"></script>
<script src="/js/jquery.nicescroll.js" type="text/javascript"></script>
<!--custom script for all page-->
<script src="/js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
Expand Down
3 changes: 2 additions & 1 deletion docs/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,11 @@ table tr th { color: #007AFF;}
/*sidebar navigation*/

#sidebar {
width: 180px;
width: 190px;
height: 100%;
position: fixed;
background: #ffffff;
overflow-y: auto;
}

.nav-collapse.collapse {
Expand Down
8 changes: 0 additions & 8 deletions docs/static/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ function initializeJS() {
//popovers
jQuery('.popovers').popover();

//custom scrollbar
//for html
jQuery("html").niceScroll({styler:"fb",cursorcolor:"#007AFF", cursorwidth: '6', cursorborderradius: '10px', background: '#F7F7F7', cursorborder: '', zindex: '1000'});
//for sidebar
jQuery("#sidebar").niceScroll({styler:"fb",cursorcolor:"#007AFF", cursorwidth: '3', cursorborderradius: '10px', background: '#F7F7F7', cursorborder: ''});
// for scroll panel
jQuery(".scroll-panel").niceScroll({styler:"fb",cursorcolor:"#007AFF", cursorwidth: '3', cursorborderradius: '10px', background: '#F7F7F7', cursorborder: ''});

//sidebar dropdown menu
jQuery('#sidebar .sub-menu > a').click(function () {
var last = jQuery('.sub-menu.open', jQuery('#sidebar'));
Expand Down
18 changes: 17 additions & 1 deletion hugolib/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,21 @@ func (page *Page) Layout(l ...string) []string {

func layouts(types string, layout string) (layouts []string) {
t := strings.Split(types, "/")

// Add type/layout.html
for i := range t {
search := t[:len(t)-i]
layouts = append(layouts, fmt.Sprintf("%s/%s.html", strings.ToLower(path.Join(search...)), layout))
}
layouts = append(layouts, fmt.Sprintf("%s.html", layout))

// Add _default/layout.html
layouts = append(layouts, fmt.Sprintf("_default/%s.html", layout))

// Add theme/type/layout.html & theme/_default/layout.html
for _, l := range layouts {
layouts = append(layouts, "theme/"+l)
}

return
}

Expand Down Expand Up @@ -504,12 +514,18 @@ func (p *Page) Render(layout ...string) template.HTML {
func (p *Page) ExecuteTemplate(layout string) *bytes.Buffer {
l := p.Layout(layout)
buffer := new(bytes.Buffer)
worked := false
for _, layout := range l {
if p.Tmpl.Lookup(layout) != nil {
p.Tmpl.ExecuteTemplate(buffer, layout, p)
worked = true
break
}
}
if !worked {
jww.ERROR.Println("Unable to render", layout, ".")
jww.ERROR.Println("Expecting to find a template in either the theme/layouts or /layouts in one of the following relative locations", l)
}
return buffer
}

Expand Down
Loading