-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Is it possible to have wiki pages in sub-folder? #16456
Labels
type/question
Issue needs no code to be fixed, only a description on how to fix it yourself.
Comments
noerw
added
the
type/question
Issue needs no code to be fixed, only a description on how to fix it yourself.
label
Jul 16, 2021
Hi! No, this is currently not supported. The following badly tested patch enables listing and viewing files in subdirs. But it's a hacky solution and a good implementation would clean up the tree-entry code paths for the wiki entirely. Feel free to further work on this :) diff --git a/routers/web/repo/wiki.go b/routers/web/repo/wiki.go
index 5271fe9b4..539f43619 100644
--- a/routers/web/repo/wiki.go
+++ b/routers/web/repo/wiki.go
@@ -142,7 +142,7 @@ func renderViewPage(ctx *context.Context) (*git.Repository, *git.TreeEntry) {
}
// Get page list.
- entries, err := commit.ListEntries()
+ entries, err := commit.ListEntriesRecursive()
if err != nil {
if wikiRepo != nil {
wikiRepo.Close()
@@ -151,6 +151,7 @@ func renderViewPage(ctx *context.Context) (*git.Repository, *git.TreeEntry) {
return nil, nil
}
pages := make([]PageMeta, 0, len(entries))
+ var wikiEntry *git.TreeEntry
for _, entry := range entries {
if !entry.IsRegular() {
continue
@@ -168,6 +169,7 @@ func renderViewPage(ctx *context.Context) (*git.Repository, *git.TreeEntry) {
} else if wikiName == "_Sidebar" || wikiName == "_Footer" {
continue
}
+ wikiEntry = entry
pages = append(pages, PageMeta{
Name: wikiName,
SubURL: wiki_service.NameToSubURL(wikiName),
@@ -188,6 +190,7 @@ func renderViewPage(ctx *context.Context) (*git.Repository, *git.TreeEntry) {
//lookup filename in wiki - get filecontent, gitTree entry , real filename
data, entry, pageFilename, noEntry := wikiContentsByName(ctx, commit, pageName)
+ entry = wikiEntry // HACK: the entry returned by wikiContentsByName does not include the full path to the file, but the wikiEntry we got above does. ideally don't do a duplicate entry look up in the first place!
if noEntry {
ctx.Redirect(ctx.Repo.RepoLink + "/wiki/_pages")
}
@@ -473,7 +476,7 @@ func WikiPages(ctx *context.Context) {
return
}
- entries, err := commit.ListEntries()
+ entries, err := commit.ListEntriesRecursive()
if err != nil {
if wikiRepo != nil {
wikiRepo.Close() |
see #7390 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
I put wiki pages in a folder hierarchy, but gitea wiki doesn't seem to show them, I can see only the pages at the same level as the Home page. Is it possible at all?
The text was updated successfully, but these errors were encountered: