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

[Bug]: Documents in nested folders are not processed #30

Closed
damms005 opened this issue Jun 27, 2024 · 11 comments
Closed

[Bug]: Documents in nested folders are not processed #30

damms005 opened this issue Jun 27, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@damms005
Copy link
Contributor

What happened?

I want markdowns in nested documents to be displayed but when I add them they are not displayed

How to reproduce the bug

  • Run the command to create the documents, e.g. php artisan docs:make selections.main.getting-started
  • Check the docs folder and confirm the files are added
  • Add markdown content to the markdown files auto-generated above
  • Visit the documentation page in the browser
  • The markdown files are missing from the navigation menu

Package Version

1.6

PHP Version

8.3

Laravel Version

11.0

Which operating systems does with happen with?

macOS

Notes

No response

@damms005 damms005 added the bug Something isn't working label Jun 27, 2024
@lukas-frey
Copy link
Contributor

lukas-frey commented Jun 27, 2024

Knowledge base currently only allows nesting into 3 levels, due to filament sidebar navigation limitations.

If you want the third level to be displayed (in your case getting-started), you need to:

  • a) create a parent page, so you also need to run php artisan docs:make selections.main and write the main page. Make sure to also set a title in the front-matter.
  • b) You need to then set the parent in the front-matter of the getting-started doc to main

Your resulting navigation should then look like this:
image

@damms005
Copy link
Contributor Author

How do I set the parent in the front-matter? Also, is any of these documented anywhere?

I think there is so much that can be done with the frontmatter but that are largely undocumented, similarly to how I recently learnt about using order in frontmatter

I think a section in the readme/docs deserve to be dedicated to what can be done with frontmatter, and from my explanation above, such section already has at least two sub headings.

@lukas-frey
Copy link
Contributor

How do I set the parent in the front-matter? Also, is any of these documented anywhere?

I think there is so much that can be done with the frontmatter but that are largely undocumented, similarly to how I recently learnt about using order in frontmatter

I think a section in the readme/docs deserve to be dedicated to what can be done with frontmatter, and from my explanation above, such section already has at least two sub headings.

Yeah, as soon as I'll get some time I'll document all missing front matter parameters available.

parent is the property to set the parent.

So in your case, parent: main and in the main.md file you set the title like title: Main for example.

There's a bug that when you don't set the title, it won't use the filename and won't render, otherwise the title property would have been optional.

Will fix it in then next release also.

@markwillow
Copy link

@lukas-frey

I tried doing this:

main.md

title: Main

Main Page Content

This is the main page content.

child.md

title: Child Page
parent: main

Child Page Content

This is the child page content.

image

@markwillow
Copy link

I get it now.

@markwillow
Copy link

To clarify the process of creating a parent-child relationship in the left-side navigation panel, please follow these steps:

  1. Create a parent document: Execute the command docs:make test.main.
  2. Update your data: Ensure to set the title, for instance, title: Main.
  3. Create a child document: Execute the command docs:make test.child1.
  4. Update your data: Add a title and specify the parent. For example, parent: Main. Note that this is case-sensitive, so ensure the data matches precisely.

@markwillow
Copy link

If you could also implement the third-level relationship, that would be helpful.

@lukas-frey
Copy link
Contributor

Third-level documentation is supported. More is not possible due to filament's limitations.

The first level is a navigation group, second level is a navigation item and third level is a child navigation item within another navigation item. More is not supported by filament currently.

@schaper1337
Copy link

Using the title (case sensitive) works for me to have the child rendered in the navigation, but trying to render the page results in the error:

Guava\FilamentKnowledgeBase\KnowledgeBase::documentable(): Argument #1 ($documentable) must be of type Guava\FilamentKnowledgeBase\Contracts\Documentable|string, null given,

main.md (parent) looks like this:

---
title: Überblick
icon: heroicon-o-building-office-2
---

# Unternehmen 

whatever...

test.md (child) looks like this:

---
title: Test
icon: heroicon-o-arrow-path
parent: main
---

# some crud stuff

Setting parent in test.md to "Überblick" will render the test.md link in the navigation, but navigating to it leads to the above mentioned error. Also I don't believe that the title attribute value (case sensitive) should be used here (?!). But using the filename does not render the page at all.

@lukas-frey
Copy link
Contributor

lukas-frey commented Dec 5, 2024

hi @schaper1337 the parent items use Filament's Navigation Items in the background, therefore you indeed have to specify the "title" in the parent, because that's how it works in Filament also.

Moreover, the 3rd level documentations follow the directory structure, so you need to create a folder main and inside there you can put your test.md file for it to work.

I know that the documentation is quite unclear on how the 3rd level navigation works, I don't have much time to rework the readme / documentation right now.

EDIT:
So for example, if your main.md file is in /docs/de/my-model/main.md you would put the test.md file in /docs/de/my-model/main/test.md

@schaper1337
Copy link

Hey, thanks!

The Documentation is a bit thin on how this works (no offense), but your quick reply saved the Day :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants