return p.AbsPathify(p.layoutDir)
}
-// GetStaticDirPath returns the absolute path to the static file dir
-// for the current Hugo project.
-func (p *PathSpec) GetStaticDirPath() string {
- return p.AbsPathify(p.StaticDir())
-}
-
// GetThemeDir gets the root directory of the current theme, if there is one.
// If there is no theme, returns the empty string.
func (p *PathSpec) GetThemeDir() string {
return dir
}
-// MakeStaticPathRelative makes a relative path to the static files directory.
-// It does so by taking either the project's static path or the theme's static
-// path into consideration.
-func (p *PathSpec) MakeStaticPathRelative(inPath string) (string, error) {
- staticDir := p.GetStaticDirPath()
- themeStaticDir := p.GetThemesDirPath()
-
- return makePathRelative(inPath, staticDir, themeStaticDir)
-}
-
func makePathRelative(inPath string, possibleDirectories ...string) (string, error) {
for _, currentPath := range possibleDirectories {
return p.workingDir
}
-// StaticDir returns the relative static dir in the current configuration.
-func (p *PathSpec) StaticDir() string {
- return p.staticDirs[len(p.staticDirs)-1]
-}
-
// StaticDirs returns the relative static dirs for the current configuration.
func (p *PathSpec) StaticDirs() []string {
return p.staticDirs
require.Equal(t, "thethemes", p.themesDir)
require.Equal(t, "thelayouts", p.layoutDir)
require.Equal(t, "thework", p.workingDir)
- require.Equal(t, "thestatic", p.StaticDir())
require.Equal(t, "thetheme", p.theme)
}
return err
}
- staticDir := s.PathSpec.GetStaticDirPath() + "/"
-
sp := source.NewSourceSpec(s.Cfg, s.Fs)
- s.Source = sp.NewFilesystem(s.absContentDir(), staticDir)
+ s.Source = sp.NewFilesystem(s.absContentDir())
return
}