Grav: Does Grav have custom content types?

Created on 5 Nov 2015  路  17Comments  路  Source: getgrav/grav

Hi! I am new to grav and just wondering if i can make custom content types like custom post types of a wordpress. so instead of having just post, pages. I can make custom like business or directories?

or am i looking at it the wrong way. Sorry. Noob here. I am new to flat file cms. hope someone can guide me thanks.

question

Most helpful comment

@rhukster
I'd have a question related to this, is there a way out of the box to customise the Add Page button/menu to allow to create custom pages directly using predefined settings based on these blueprints.
For example the menu by default has these choices:

  • Add Page
  • Add Folder
  • Add Modular

I'd like to add things like
Add Blog Post

Which would automatically set things up so that page would be created inside the blog/ directory
with an "Item" page template etc..

Do I need a custom plugin in order to accomplish this?

All 17 comments

Grav is completely flexible in regards to custom content types. You can create whatever you like. Take a look at this:

http://learn.getgrav.org/content/headers#custom-page-headers

Oops, didn't mean to close that just now..

Regarding your twitter question:

Every page in Grav is represented by a template that defines how that is output. So a Page can be a blog list, a blog item, a contact page, a standard page, whatever you decide your site needs.

Each page is a markdown file (.md) with a YAML frontmatter section at the top. This frontmatter defines the standard page headers, plus you can put in custom stuff (or post types if you use the WordPress naming). There are no restrictions or limits on this other than that they should be valid YAML.

Because this is unstructured by default, you would have to use the same structure in like pages. If you use the admin panel, you can create a blueprint (see Antimatter theme's blueprints/ folder for examples). These are again YAML files that define fields so they can be rendered as forms. The whole of the admin is defined by these files, you can see many other examples in system/blueprints.

Hope this helps!!

Sorry but you lost me there. I still quite don't understand. Maybe I am looking it at the wrong way. I have been working to much with wordpress.

But if i were to use the admin plugin? will all the content types be on just the pages?
or will it have its own post types?

like post -> to just see all the posts
page -> just pages

custom post type 1 => for just this type

I checked the linked that you gave but i still cant follow? Do you specify it to the header?

read my post above, i think we replied at the same time.

so does it mean if i have a post type of listings and business. If I am using the admin plugin.
it will all still be at the pages

Page

  • Listing
    -- Listing Posts
  • Business
    -- Business Posts

or will it be
Page

  • My pages

Listing

  • Listing 1
  • Listing 2

Business

  • Business 1
  • Business 2

Can the administration page be themed as well?
Can grav also be used for creating web applications?

The admin shows all the pages as the folder structure dictates. however you can filter by page type:

2015-11-05 at 3 52 pm

Currently the admin cannot be themed. This is something we plan on adding in the Pro version of the admin plugin.

Grav can be used to build web applications, but that's a very broad term. Basically you can build pretty much anything as a custom plugin. For example the admin is just a plugin for Grav.

Wow. I am excited to try it now. Thanks for the fast support. =)

Hi! I am trying grav right now but i am encountering some errors. I am using easyphp as a local server.

I created a virtual host called mygrav.com
but when i try to access it by mygrav.com I get a ERR_CONNECTION_REFUSED

I am only able to view the site if i use http://192.168.0.101/my%20portable%20files/grav-test/

Already got it working. Thanks!

When creating a modular page. will it have its own fields in the admin page? can i edit the modular pages fields from the admin?

Of course. Install the one-page skeleton, install the admin plugin, then navigate to one of the modular pages and you will see a custom tab. Check out 'features' modular type for example

@rhukster

screen shot 2017-03-31 at 1 12 21 pm

I am trying to do precisely what you had noted in this screenshot (trying to create Wordpressy content types), but I am not finding this filterable content interface.

Where does this exist from within the Grav Admin gui?

@kelseyurgorenci
In the admin, choose the "Pages" tab in the side bar. Then you'll see it at the top of the panel just above the section where all your pages are listed

@fireraccoon I see it! Thanks. I love Grav btw. What an incredible alternative to a huge clunky Wordpress site.

@rhukster
I'd have a question related to this, is there a way out of the box to customise the Add Page button/menu to allow to create custom pages directly using predefined settings based on these blueprints.
For example the menu by default has these choices:

  • Add Page
  • Add Folder
  • Add Modular

I'd like to add things like
Add Blog Post

Which would automatically set things up so that page would be created inside the blog/ directory
with an "Item" page template etc..

Do I need a custom plugin in order to accomplish this?

@fireraccoon this is currently not possible. You can open an issue on the Admin plugin repo for this.

Was this page helpful?
0 / 5 - 0 ratings