"Knowledge Base" skeleton broken

“Knowledge Base” skeleton broken?

I downloaded the skeleton “Knowledge Base” and unpacked it according to the instructions, local. When I want to start the internal server, I get the error message:

command "server" not defined

With the “Core + Admin” zip everything works fine, the server starts and I can reach both the admin and the site with localhost.

So I tried to install the “Knowledge Base” theme in the “Core+Admin”. I was able to install it, but the output of the pages is broken, you can see a lot of code.

I also tried to insert “Knowledge Base” including the sample pages in “Core+Admin”, using copy paste. But even there I get the broken output.

If I install the “Striped” theme, then I can see the sample pages of “Knowledge Base” correctly.

I think something is broken with “Knowledge Base” and possibly also with the build-in server in the skeleton.

@LinuC, Be advised that ~60% of themes are old (abandoned) and not upgraded to Grav 1.7. Grav 1.7 has introduced breaking changes.

One of the breaking changes has been introduced to address a cross-site-scripting security vulnerability in Twig. Following the advise on fixing the breaking change, will introduce the security issue again…

Your problem is probably related to above mentioned Twig compatibility issue. See the first bullet point of Most Common Issues.

My suggestion would be to stick to themes build by the Grav team, or only teams that are created after the introduction of Grav 1.7 (Jan 2021).

To check if a theme is Grav 1.7 compatible, check the Twig code for the |raw filter on output commands like {{ page.content | raw}}.

Thanks for the information!

For a moment the theme worked, but with the sample pages of another theme. Then I copied the /user/pages folder from the skeleton to the grav-admin installation and again had the problem with the code. Apparently, there is also something not good in the individual pages.

https://learn.getgrav.org/17/advanced/grav-development/grav-17-upgrade-guide#twig

The theme would be very interesting for me. But I need at least the homepage, which shows the category selection. I can then recreate the other pages and hope that they will then be displayed correctly. Or is it a template that I need to change?

Maybe I can also reach the creators of the theme and motivate them to adapt it to the new method of Grav?

If you can still help me a little further, then I’m glad :slightly_smiling_face:

EDIT:
I sent perlkonig a message.

I’m sorry, but I don’t actively follow Grav anymore. As much as I’d like to say that I’ll make some time to try to bring this theme and my many plugins over to 1.7, the reality is that I simply can’t. I’ll be marking all my Grav repositories as “abandoned,” and those interested in taking anything over should use the “Abandoned Resource Protocol” to fork and replace.

1 Like

This is a great pity! But understandable in these difficult times.

I have now read your instructions on GitHub and understand a little better.

https://github.com/Perlkonig/grav-theme-knowledge-base

Will I be able to use your theme with the above settings for twig? With a sample page of another theme, I was able to display an article, but the home page was not built. I’ll try again, but I’m totally new to Grav.

All the best!

The theme expects your pages to be laid out in a certain way. The skeleton repo shows you how. There may be fundamental issues with the Twig under 1.7. You’ll have to rely on the community to ferret those out, or hope someone is able to fork, fix, and replace. Sorry I can’t be of more help. I simply don’t know what has changed.

I’m not a programmer, unfortunately, but I’ll try to figure out how to adapt a theme to version 1.7. Maybe there is a guide to this? The settings for YAML and Twig, as described on the following website, unfortunately do not help. It probably needs some adaptation in code.

Ok, that was the answer I wanted to post. But fortunately, I looked at the instructions again and in the system.yaml checks which settings are there.

strict_mode:
  twig_compat: true

was correct, but not

twig:
  autoescape: false

Why? Because I made the setting in the admin and only half is done there! Yes, sometimes you have to look closely :upside_down_face:

Now your theme is displayed correctly and your sample pages are all working correctly! Now I can start to understand it better, how everything is structured. Where to define the categories? How to display the title of a category without linking (for example, Topic 1 should be just a text)? How to turn off the counter? How to change the display in the sidebar, or hide the sidebar? How does it work with 4 languages and translated categories? And what other plugins do I need (TOC, language switcher, widgets)? And if all this works, then the big question comes:

Does it also work as a static website, created with the plugin “static”?

But the main thing is, I can now start testing it. Maybe, if I manage to build my website with it and I understand the theme better, I can adapt it to version 1.7. But it will not be possible very quickly.

Thank you for your great work and your theme!