I’m setting up my first Kirby environment and I’m having a strange problem.
I’ve set up a folder called 1-words, and inside I want to put in dated articles so, as a test, I put in the following subfolders:
20151207-lorem-ipsum-dolor-sit-amet
20151208-consectetuer-adipsicing
So far so good but, when I refresh my home page, the date strings get removed from the folder names, making them invisible, like this:
-lorem-ipsum-dolor-sit-amet
-consectetuer-adipsicing
It does this with just a single digit number, and it does it if I’m not even referencing those folders in my code. But if definitely happens when I hit Cmd-R in my browser.
Your help would be gratefully received. I’m on Mac OS X (El Cap), PHP 5.5.30.
Yeah, thanks. Seems there’s a chunk of stuff I didn’t do because I didn’t RTFM
It works now. Thanks for your help.
EDIT: it worked in that it automatically suffixed the folder name with the correct date, but it’s then deleting that suffix when I refresh the home page. I can’t think what I’ve (not) done that would cause that to happen.
Here’s a video that shows what’s happening (forgive a lack of commentary - the washing machine is on
Hm. Generally the Kirby core shouldn’t ever modify pages if you don’t tell it to do so. Since the issue appears when reloading the frontend home page, that’s very weird. Does it also happen with the starterkit?
`<?php if(!defined('KIRBY')) exit ?>
title: Article list
pages:
template: words
num: date
files: false
fields:
title:
label: Title
type: text
text:
label: Text
type: textarea`
…and for the Words template:
`<?php if(!defined('KIRBY')) exit ?>
title: Words
pages:
num:
mode: date
field: added
sortable: true
files:
sortable: true
fields:
date:
label: Date
type: date
default: today
override: true
title:
label: Title
type: text
text:
label: Text
type: textarea
tags:
label: Tags
type: tags`
The thing that struck me is the fact that when you change visibility, you get a list of numbers instead just the question if you want to change the visibility. With date based numbering there is no possibility to choose the position of the number, as this happens automatically by date.
Therefore, pls. check that the filename of the list page blueprint is the same as the name of the list page text file, i.e. if the text fiel is called “list.txt” the blueprint must be called “list.php” for the stuff to work.
Also since the automatic renaming happens on the frontend, the blueprints don’t matter there, which is very strange. Are you using the page write methods (create(), update() and so on) anywhere in your templates?
OK, I think I know where the problem was. I started again from scratch, set up my blueprints properly, then imported my original templates back in a bit at a time. Looks like I was trying to do a sortBy() on my pages, which was changing the folder names.
I need to find an alternative way to display the latest-dated article.