File list on page

#1

Hi,

I’m trying to build a page which looks like a blog page with a title, date, tags, two or more textareas, a picture and a list of files which then can be downloaded.

So I started with building the blog page as described in the cookbook which doesn’t really work (if I click on the third article in the list, I get the fourth article displayed). I’ve not found a way to add the manually added blog page (in the content folder) in the panel of the Starterkit.

I do see the blog page and the articles I added manually on the webpage. Now I want to list available files for the article and make them downloadable, but I’m stuck with this.

How can I:

  • show a list of available files on my article page?
  • define, which values should be displayed for the files in the list (icon, name, date, size)?
  • make the file downloadable from the list?

It would be great if you could point me to the right spot in the documentation or even better if you could show an example of such a page.

Thanks for your support
Christian

0 Likes

#2

It would be good to know what you already have, because the blog cookbook is already quite extensive and it doesn’t really make sense to repeat it here.

  • To get a list of all files, you can use $page->files() (this would go into your article.php template), which gives you a collection of all files of that page you can then loop through and create your download link.

  • If you store meta data for the files, you can access this data via the field names or file methods, e.g. $file->size(), $file->caption()(if you have a caption field) etc.

  • To make the file downloadable, you you different possibilities, one is adding the download attribute to the file link.

Our reference also has example blog blueprints for the Panel: https://getkirby.com/docs/reference/panel/samples/blog

0 Likes

#3

Hi,

thank you for your support. I did start from scratch with the blog and with your tips, the file list works fine now with the download.

The only issue I still have is, that my blog page (and my search page) doesn’t show up in the panel as shown in https://getkirby.com/docs/reference/panel/samples/blog. All I see in the panel is the standard view of the Starterkit. I do see the blog page (and the search page) on the “rendered” website.

What do I have to do to show the blog page in the panel to be able to get to the article page within the panel to be able to create or edit article pages?

Thank’s
Christian

0 Likes

#4

What is shown on the start page is defined in the /site/blueprints/site.yml blueprint. Currently, there are three sections.

  1. the albums shown on the lefttt
  2. the notes shown on the top right
  3. all other pages on the bottom right

I suggest you add a new pages section that lists your blog pages

title: Site

columns:
  - width: 1/2
    sections:
      albums: sections/albums
  - width: 1/2
    sections:
      notes: sections/notes
      # new blog section
      blog:
        type: pages
        templates:
          - article
      pages:
        type: pages
        create: default
        template:
          - about
          - home
          - default

0 Likes

#5

Wow, you’re quick!
Thank you. That worked fine.

Is it possible, that I can add a field on my article page in the panel to select one or more fields which would then added to the article (in the article folder within the content) or do I have to build this like the photography gallery?

0 Likes

#6

Hm, I’m afraid I don’t really understand the question :thinking:

0 Likes

#7

…when I’m adding a new article for my blog in the panel, I’d like to have a way to “upload” the files I’m going to show (as available downloads) on the article page. Example: In the article I’m writing about a special function in excel and I want the excel-file related to this article to be downloadable for the user.

0 Likes

#8

Ah, I see.

You can create a files section in your article template to upload files. In your files section, you can define a template for the files (with the meta data fields for each file, if you want this).

If you have difficulties implementing this in your article.yml blueprint, please post it here.

0 Likes

#9

Thank you for the hints :wink:
It works now and I learnt a lot about Kirby.

Best regards
Christian

1 Like