picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.86k stars 616 forks source link

Pico 4.0 and beyond #317

Open PhrozenByte opened 8 years ago

PhrozenByte commented 8 years ago

This issue is intended to collect and discuss ideas about Pico 2.0 3.0 4.0, especially on how we can make Pico's plugin system more flexible than ever. The changes are very substantial and far reaching, therefore they can't make it into the soon-to-be-released Pico 2.0 3.0. The changes break BC, therefore they [can't make it into Pico ~~1.1 2.1 3.1, but Pico 2.0 3.0 4.0](http://semver.org/).~~ Features planned for Pico 2.0 can be found in #270. Feedback is appreciated! :smiley:

General

Page management

Plugin event system

New official plugins

Not planned anymore

Crank1d commented 8 years ago

I have idea on how to make pages more flexible - in other words, having "custom page types" based on XML schema file (or YAML, maybe?) in content directory without writing specific meta data into every .md file.

This would make Pico more CMS-like and structured, so for example, if someone would like to have "blog" or "products" type of pages, each containing alot of "child pages" (subpages), he should create XML schema file called "blogposts.xml", which contains info/data describing how subpages should behave, like order of pages, pagination count etc. and any pages associated with schema put into subfolder in content directory. This would probably branch content directory structure into several subfolders for specific page type so structure would be something like "default" - for default pages, "posts" - for blog posts or any other page types. Index pages for those page types could also contain page loop/query of all of its child pages - just like blog has, similar to Wordpress but still being simple.

Also, maybe having another XML file for post categories which would contain something like page IDs under specific category section ("Animals", for example) and when category URL is requested, category page would do the loop and display all pages associated with this category page.

I think this would be possible but would require to rewrite core Pico files, since creating Blog plugin alone would not have access to way/order pages are displayed since Pico searches folders recursively for .md files in content directory.

This would increase complexity of Pico but it would be a welcome feature which could possibly draw more people to use Pico for their website, especially those having smaller blog dedicated to specific subject, like personal travel blog, for example.

PhrozenByte commented 8 years ago

Thank you for your feedback @Crank1d! :+1:

I did not really understand what data you're suggesting to store in these XML files. Pico leaves page presentation (i.e. how a page in a specific folder (e.g. blog) looks an behaves) completely up to themes. For example, @smcdougall's NotePaper theme interprets content files differently based on YAML headers (e.g. NotePaper's widget feature or blog articles). NotePaper specifically also allows you to set a Tag meta header and lists all pages containing a specific tag (so implementing categories shouldn't be a problem either).

As far as I understand your suggestion right, Pico already allows you to do something like this - it just doesn't require you to create a separate XML file, you can simply store that information in the YAML header of the content file.

Crank1d commented 8 years ago

Something like "Page Blueprints", implemented in GRAV - http://learn.getgrav.org/forms/blueprints

Scheme file would contain custom defined meta data for all its child pages/subpages, so there would be no need to define custom meta from plugin.

Maybe Im wrong, but Pico currently doesnt support "parent-children" relationship of pages?

PhrozenByte commented 8 years ago

As far as I understand Grav's documentation right, blueprints are about metadata for plugins and themes, not about pages. Pico has no administration backend. We're indeed working on a editor plugin for Pico 1.1 (see PhrozenByte/pico-admin), but that's rather a "enhanced" text input field. Much more "administration backend" is in contradiction to Pico's "stupidly simple" goal (what isn't limited to the user-side, but also Pico's sourcecode).

Pico doesn't have a "parent-child" relationship of pages in the narrow sense. When it comes down to "folder-specific meta data defaults": Pico absolutely allows you to do something like this, e.g. by creating a _meta.md file and adding its meta data to all other pages in this directory by using the onPagesLoaded event with a very simple plugin. Apart from that, Pico leaves the directory structure completely up to the user and maybe a custom theme that interprets the directory structure to do something special (like listing all pages in categories).

Crank1d commented 8 years ago

OK, thanks for explanation.

mayamcdougall commented 8 years ago

Just a thought... If you wanted to add the feature sooner, it'd probably be easier to make the "static website generator" a manual process for the initial implementation. The automation (presumably the harder part) could be developed in stages afterward.

Maybe you'd want them to be two separate components anyway. A "worker" that builds the static site and an optional "watcher" daemon/process that provides the file tracking and automation. This would also allow users the freedom to decide it they wanted the extra automation or whether they'd rather rebuild manually.

Anyway, just some stray thoughts from having dealt with my odd, manual Jekyll setup.

Even if it had to be rebuilt manually each time, it might get Pico to a state where you'd want to use it for the website sooner. :wink:

mayamcdougall commented 8 years ago

Another random thought. Not really big enough for it's own issue.

What about having some kind of performance monitoring in Pico? I'd call it separate from the "static website generator" because it could be useful for regular, dynamic Pico sites.

Basically, I've noticed with Jekyll that whenever it rebuilds the site, it tells me how long it takes. I've noticed that certain actions (like jsonify) take a LOT longer than others. I think it would be interesting for Pico theme and plugin developers to be able to measure the impact of their actions.

It would probably be a toggle or a plugin, since it wouldn't really have a production use.

A detailed breakdown of performance timings could be cool too.

Pico Core.................................10ms
Plugin 'something_low_level.php'..........20ms
Parsedown.................................80ms
Plugin 'pagination.php'...................50ms
Twig using template 'NotePaper'..........200ms
----------------------------------------------
Total Rendering Time.....................360ms

The timings here are of course made up.

Again, just an idea I had for the future. I can make it a new issue if you'd like.

PhrozenByte commented 8 years ago

Just a thought... If you wanted to add the feature sooner, it'd probably be easier to make the "static website generator" a manual process for the initial implementation.

Actually it's already possible to use Pico as a static website generator - simply use wget -r to recursively get a static version of the website. Whether the result is usable or not depends on what plugins have been "installed". The primary target of this feature actually is caching the HTML results to boost performance, using Pico as static website generator is just a side benefit.

The decision to use Jekyll was made before I knew about what power Travis gives us. So, if you want to do a little research whether we can use Pico 1.0 instead... That is something which I would greatly welcome. :wink: :smiley:

Maybe you'd want them to be two separate components anyway. A "worker" that builds the static site and an optional "watcher" daemon/process that provides the file tracking and automation.

I haven't thought about a concrete implementation yet. So, yeah, maybe :wink:

What about having some kind of performance monitoring in Pico?

We'll keep this in mind (I've added it to the list above), but at the moment there are some ToDos which will boost performance significantly (Markdown cache, lazy loading of pages...), so it IMHO doesn't make much sense to publish performance stats when we already know that we can do much better.

mayamcdougall commented 8 years ago

The primary target of this feature actually is caching the HTML results to boost performance, using Pico as static website generator is just a side benefit.

Yeah, I'm interested in seeing how it plays out. I've played with Nginx's caching abilities and seen my pages go from 500ms+ down to near instant loading times.

Maybe I should go write a script that wget's into a static folder on demand. :laughing:

For the performance stats, I'm more curious from a theming perspective. It would be interesting to be able to track performance changes between different ideas. If I change the way something works, and all of a sudden it's taking an extra 100ms or more, I'd know that my implementation was poor.

It would actually be kind of interesting to see how NotePaper performs next to a barebones theme. There's probably a way I could send a request to php directly from a shell, then time the response using some command line trickery. I might see what I can do if I'm every working on NotePaper. Far too busy for that at the moment though.

Chris2011 commented 7 years ago

What is happened with the Static HTML Cache? Is this the Pico Cache plugin: https://github.com/glumb/pico_cache?

iagovar commented 6 years ago

Allow PHP includes in pages please.

wlabarron commented 6 years ago

The Static HTML caching feature would be fantastic and probably quite convenient for a Search system to use.

KanyonKris commented 5 years ago

What about moving to a newer version of Twig 1.x or to Twig 2.x?

PhrozenByte commented 5 years ago

Just run composer update in your existing Pico installation (no matter whether you used a composer-based install or one of Pico's pre-built packages) to update to the latest Twig 1.x release.

But indeed, we're planning to upgrade all of Pico's dependencies to the latest versions, including Twig 2.x, the latest release of Symfony's YAML parser and Parsedown 2.0 :smiley:

ghost commented 5 years ago

Dear Daniel,

I'm trying to create knowledge base on Pico and it cool and great solution, I like it all, except performance. When I add 3840 articles — it's nightmare, 2kb index page could load ~ 1 sec, and dances with nginx and php-fpm doesn't affect. Unfortunately, PicoTooManyPage plugin doesn't support 2.0 branch. Might you have some alpha or beta version of Pico 3.0 that making a lazy page tree?

PhrozenByte commented 5 years ago

Unfortunately I can't give you any schedule or even an idea about when this will happen, my time is very limited recently. However, I can't really see any reason why PicoTooManyPages shouldn't work with Pico 2.0+

ghost commented 5 years ago

I've asked Bigi about PicoTooManyPages. Unfortunately, the plugin isn't adopted to Pico 2.0 and doesn't work. Anyway, waiting for new version :)

PhrozenByte commented 5 years ago

That's rather an docs issue on the plugin's side than an actual problem with the plugin :smiley:

Pico tries to maintain compatibility, even with plugins written for Pico 0.X (back to 2013). Just very few plugins actually stopped working. In your case it's simply the fact that Pico 2.0 no longer silently ignores (possibly unintentionally not working) plugins in the plugins/ directory - and stumbles over the plugin's picotmp_dummy directory. However, that's really easy to fix. Simply create a plugins/PicoTooManyPages/ folder and put all of the plugin's files in there (i.e. giving you plugins/PicoTooManyPages/PicoTooManyPages.php).

ghost commented 5 years ago

thank you for the advice, i'll try this way and patiency wait for a new version of Pico

codeandmedia commented 4 years ago

Hi, I was trying Pico CMS before and had created a theme and simple deployment shellscript for Pico CMS. During this holidays (Merry Cristmas!) I finally have shared it on Github. Maybe someone will be interested

https://github.com/codeandmedia/pico_deploy - shellscript https://github.com/codeandmedia/pico_mondrian - the theme

mayamcdougall commented 4 years ago

I wrote four lines of HTML, for the first time in years, and this notification popped into my inbox. It's apparently the last Pico thread I haven't unsubscribed from. 😒

Is it a sign? Probably not. But either way, @PhrozenByte, if you take a look at this and it meets your standards, I'll volunteer to add it to the Themes page (can't be that hard to remember how... 🤔 ).

PhrozenByte commented 4 years ago

Welcome back @mayamcdougall! :confetti_ball: :smiley:

Sure, looks good, go ahead :+1:

Nepose commented 4 years ago

Not sure whether this topic is still alive, but I'm going to try 😉 IMHO the 3.0 version should finally use all goods PHP7 gives us and leave support for 5.3.6 version.

bricebou commented 4 years ago

Hi @PhrozenByte ,

Thanks for all the good work you are doing on Pico CMS ! I've seen the release of the alpha version of Pico 3, and it's a great news.

But, my major concern is that I need a tag functionnality... I tried to work on a plugin a long time ago (and you saw how ugly was my code, but hey, I'm not a developper and haven't any PHP basics...) ; I see there is a plugin for version 2 but why not make tags a native functionnality in Pico 3 ?

Thanks again !

PhrozenByte commented 4 years ago

Tagging is a rather basic functionality and one of the perfect examples of what can (and should) be done with plugins. The most basic tagging functionality can even be realized with pure Twig. So if there's going to be something official it will rather be a plugin. Since time is very limited I'm afraid I can't promise that :unamused:

Anyway, maybe it's a good approach to think a little about what is needed for a Twig-only approach... There should be just some rather small hurdles I assume. We'll see... :smiley:

mayamcdougall commented 4 years ago

I mean, if you want to be technical, I came up with a Twig-only tags implementation back when I wrote NotePaper. It's very basic, and I never went back to really improve it, but it might be a good starting point if you're looking to avoid writing a proper plugin.

NotePaper as a whole is kind of unmaintained at the moment. It probably still works fine on the current version of Pico, but just be aware that it hasn't been properly maintained in a bit.

Edit: You can check out the NotePaper Site for an example of the two twig-based tag widgets I wrote.

bricebou commented 4 years ago

Thanks a lot for your answers ! I'll check Pico's development from time to time and I'll try to upgrade my website. Thanks again :)

KoljaL commented 4 years ago

Hi @PhrozenByte, i`m playing around with a new theme for my documentation website. Now it is time to make the menue and i found a lot of ways to do it. Like with the NestedPages, the Category plugins or the pages() function of pico itselfs.

But what will the (best or easiest) way to to make it fitted for pico3?

My need is a menu with all pages in their folders (without a limitation in the depth), highlighting the current page and the way through the folders from the current page to un-collapse them.

PhrozenByte commented 4 years ago

You should use Pico's new pages() Twig function @KoljaL, it already works the same way as the new page discovery will work :rocket:

KoljaL commented 4 years ago

@PhrozenByte, thanks for the hint. Is there another way for nested menus than the one in this example: https://github.com/picocms/Pico/issues/383#issuecomment-295828130? As I said, I would like to have more levels.

PhrozenByte commented 4 years ago

This example isn't even utilizing the pages() function... See http://picocms.org/in-depth/features/pages-function/

KoljaL commented 4 years ago

oh, now i know that there is a difference between pages and pages(). But i found only examples for the pages variable, like you wrote in the old themes, and nothing with the pages() function.

PhrozenByte commented 4 years ago
{% macro rnav(startPage, currentPage) %}
    {% import _self as macros %}
    {% for page in pages(startPage) %}
        {% if not page.hidden and page.title %}
            <li{% if page.id == currentPage.id %} class="current"{% endif %}>
                <a href="{{ page.url }}">{{ page.title }}</a>

                {% set childNav = macros.rnav(page.id, currentPage) %}
                {% if childNav|trim %}<ul>{{ childNav }}</ul>{% endif %}
            </li>
        {% endif %}
    {% endfor %}
{% endmacro %}

{% import _self as macros %}
{% set index = pages["index"] %}
<ul>
    <li{% if index.id == current_page.id %} class="current"{% endif %}>
        <a href="{{ index.url }}">{{ index.title }}</a>
    </li>
    {{ macros.rnav(index.id, current_page) }}
</ul>
KoljaL commented 4 years ago

Thank you for the example. I have already played with it and noticed that folders without "index.md" are not displayed at all. No matter whether they contain other files or subfolders. Is it correct that way?

PhrozenByte commented 4 years ago

Correct. If you wanna list them you'll have to use the page tree directly, see https://phrozenbyte.github.io/Pico/in-depth/features/page-tree/

KoljaL commented 4 years ago

No, it`s okay. I will put index files in every folder and do the rest in CSS. Maybe it is good to have the chance of this content possibility.

mhzawadi commented 2 years ago

Good evening lovely Devs,

Thank you so much for this super simple CMS, I have it running as both my main site and some sites in nextcloud. Would love to send some money if it would help.

I would also like to help test and move v3 forward, I have seen the Alpine Linux 3.16 drop and that drops support for PHP7. My docker image is built on Alpine and so cant bump to 3.16 just yet, what would be most helpful in doing any testing?

mhzawadi commented 2 years ago

FYI: have bumped my image to PHP8.1 and using the v3 alpha build, no errors seen. Buts its a very simple site.

Thatoo commented 1 year ago

I think it would be nice to integrate ActivityPub into PicoCMS? Maybe offering a plugin?

So far, to write blog that integrate within the fediverse through ActivityPub, there is only https://writefreely.org (no theming possible and versy difficult to install) or thanks to this wordpress plugin https://wordpress.org/plugins/activitypub/ .

lloydsargent commented 1 year ago

This is really basic: moving user plugins/content/themes all under the content directory. I’m a fan of keeping user and system files separate. ATM, it’s pretty loosey-goosey in this regards. It would also assure several things:

o Updates are simpler (whether you hand cart them like I do or use Composer (which I have never managed to get working).

o If you don’t use Composer (which I do not having never had it work), it makes updates even simpler.

o Keeps me from having to figure out what I do and don’t need .gitignore on. Frankly, it’s enough to deal with my own stuff. Just let me go “oh, that directory is magic… don’t touch it”.

i think simplifying this to PicoCMS directory and User Content directory would clean things up significantly.