When I duplicate a note, it keeps the stored toDate value, but when I add a new note, it doesn’t store that value…(FYI: I’m working with the starterkit-master content that already had “notes” pages loaded, but I edited the yml for those note pages.)
And as a result, on the front end, the ones that don’t have date stored don’t load the date, screenshot below (two above don’t have date, and two below do show the date)
Does the date field in note.yml
have the default: now
property set?
Yep, it does
Hm, that’s weird. When you create a new page, the date field should be prefilled. But you have changed the field and set time
to false, so try setting the default to today
instead of now
.
Hmm, darn, still not saving the date when I use “Add” new page. Only if I duplicate from a previously made page with date already saved.
And in the notes.yml (in sections folder) it is listed as this:
Ok, looks like you are using a different template in the section.
From which template is the field you posted above?
On a sidenote, please don’t post screenshots of code but paste the code here.
Ok will do, no more screenshots.
It could be a crossing of wires. i am trying to change the category “notes” to be called “archive” throughout the site structure. But it seems to be causing problems. Is “notes” a custom name/field or is it built into the kirby system?
So instead of the url
http://localhost:8888/starterkit-master/notes
I want it to be :
http://localhost:8888/starterkit-master/archive
I changed the correlating names from “notes” to “archive” in the yml and php files when relevant.
And the templates that are accepted on the notes/archive page are “solo” and “group”, rather than the default “note” that came with the starterkit-master
To actually change the URL of the notes page, you would have to rename the notes
folder inside the content
folder.
Also, check what content file names are actually created when you create a new page.
OK, 2 address two questions:
ONE:
when I created a new page in the “Archive” I got this in the content folder txt file:
Title: testing
----
Text: dbsfdbsfgb
----
Startdate: 2020-07-01
----
Enddate: 2020-07-29
----
Gallery:
----
Galleryinfo:
----
Tags: all
----
Thumbnail:
----
Images:
----
Related:
TWO:
I just realized that the dates being show on the list on the “Archive” page are not the toDate I input, which is pulling from this from sections/archive.yml:
type: pages
headline: Archive
parent: kirby.page("archive")
info: "{{ page.date.toDate('d.m.Y') }}"
templates:
- solo
- group
empty: No archived yet
sortBy: date desc
See below screenshots:
And I see this last piece of information is necessary to put the pieces together. This is how I’m creating those fields on the panel template yml files that the “Archive” pages use:
sections:
meta:
type: fields
fields:
startDate:
label: Start Date
type: date
time: false
default: today
endDate:
label: End Date
type: date
time: false
default: today
gallery:
label: Gallery
type: textarea
galleryInfo:
label: Gallery Address
type: textarea
In you yml files I see fields called startdate and enddate but not date.
Please note that it helps if you atttach file names to the files excerpts you quote from.
I tried also:
info: "{{ page.date.endDate('d.m.Y') }}"
but still when I added new pages, the date wasn’t being added to the list of pages in “Archive”.
By the way, thanks so much for the prompt responses!
The problem is that I can’t follow what blueprint you use to create those new pages.