Make top bar link relative
This commit is contained in:
@ -325,6 +325,17 @@ extension Element {
|
||||
+ pageParts.dropFirst(index)
|
||||
return allParts.joined(separator: "/")
|
||||
}
|
||||
|
||||
/**
|
||||
The relative path to the site root.
|
||||
*/
|
||||
var pathToRoot: String? {
|
||||
guard path != "" else {
|
||||
return nil
|
||||
}
|
||||
let downPathCount = path.components(separatedBy: "/").count
|
||||
return [String](repeating: "..", count: downPathCount).joined(separator: "/")
|
||||
}
|
||||
|
||||
/**
|
||||
Create an absolute path (relative to the root directory) for a file contained in the elements folder.
|
||||
|
Reference in New Issue
Block a user