Skip to content

Commit

Permalink
Skip Static directory if its in your content directory
Browse files Browse the repository at this point in the history
Allows organisation where all source files are in one directory:

```
`config.yaml`:

contentdir: "source"
staticdir: "source/static"
...

 .
	└── source
		├── post
		|	├── firstpost.md	// <- http://site.com/post/firstpost.html
		|	└── secondpost.md	// <- http://site.com/post/secondpost.html
		└── static
			└── css
				 └── site.css	// <- http://site.com/css/site.css
```
  • Loading branch information
rozza committed Aug 15, 2013
1 parent 3c3fc45 commit 0f143dc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hugolib/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,18 @@ func (s *Site) initialize() {

s.checkDirectories()

staticDir := s.Config.GetAbsPath(s.Config.StaticDir+"/")

walker := func(path string, fi os.FileInfo, err error) error {
if err != nil {
PrintErr("Walker: ", err)
return nil
}

if fi.IsDir() {
if (path == staticDir) {
return filepath.SkipDir
}
site.Directories = append(site.Directories, path)
return nil
} else {
Expand All @@ -211,7 +216,6 @@ func (s *Site) initialize() {
}

filepath.Walk(s.absContentDir(), walker)

s.Info = SiteInfo{
BaseUrl: template.URL(s.Config.BaseUrl),
Title: s.Config.Title,
Expand Down

0 comments on commit 0f143dc

Please sign in to comment.