From dddf7fc1b908381193fcc348df95565115c37956 Mon Sep 17 00:00:00 2001 From: Heather Yu <35639529+hetd54@users.noreply.github.com> Date: Tue, 27 Feb 2024 15:45:08 -0500 Subject: [PATCH 1/3] init collections --- public/admin/config.yml | 234 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 231 insertions(+), 3 deletions(-) diff --git a/public/admin/config.yml b/public/admin/config.yml index 8944f51..99ef4ea 100644 --- a/public/admin/config.yml +++ b/public/admin/config.yml @@ -1,12 +1,240 @@ +local_backend: true + backend: name: github repo: brown-ccv/mmp + base_url: / media_folder: public/images i18n: - # multiple_folders - persists files in `//.` structure: multiple_folders - # Required - a list of locales to show in the editor UI locales: [en, es, pt] - # Optional, defaults to the first item in locales. # The locale to be used for fields validation and as a baseline for the entry. default_locale: en +collections: + - name: people + i18n: true + label: People + folder: src/content/people + create: true + fields: + - name: name + i18n: true + label: Name + widget: string + - name: title + i18n: true + label: Title + widget: string + - name: avatar + i18n: duplicate + label: Photo + widget: image + - name: org + i18n: true + label: Company/University + widget: string + - name: address + i18n: duplicate + label: Mailing Address + widget: text + - name: phone + i18n: duplicate + label: Phone Number + widget: string + pattern: ['^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$', 'Phone number must follow standard guidelines'] + - name: email + i18n: duplicate + label: Email + widget: string + pattern: ['.+@.+\..+', 'Email must follow standard guidelines'] + - name: startDate + i18n: duplicate + label: Year Started Contributions + widget: datetime + date_format: yyyy + time_format: false + format: yyyy + - name: endDate + i18n: duplicate + label: Year Ended Contributions + widget: datetime + date_format: yyyy + time_format: false + format: yyyy + - name: pubs + i18n: true + label: Publications + folder: src/content/pubs + create: true + slug: '{{year}}-{{month}}-{{day}}_{{title}}_{{slug}}' + fields: + - name: classification + i18n: true + label: Classification + widget: select + options: [ 'Book', 'Chapter', 'Article', 'Dissertation' ] + - name: citation + i18n: duplicate + label: Citation + widget: text + - name: url + i18n: duplicate + label: Link to Publication + widget: string + - name: data + i18n: true + label: Data + create: true + folder: src/content/data + fields: + - name: title + i18n: true + label: Title + widget: string + - name: description + i18n: true + label: Description + widget: text + - name: file + i18n: duplicate + label: File + widget: file + - name: cat + i18n: true + label: Category + widget: select + options: ['Study Design', 'Questionnaire', 'Changes to Questionnaire', 'Code Book', 'Appendices'] + - name: graphs + i18n: true + label: Graphs & Figures + create: true + folder: src/content/graphs + fields: + - name: title + i18n: true + label: Title + widget: string + - name: year + i18n: duplicate + label: Year + widget: datetime + date_format: dd.MM.yyyy + time_format: false + format: yyyy + - name: image + i18n: duplicate + label: Image + widget: image + - name: history + i18n: true + label: Oral History + create: true + folder: src/content/history + fields: + - name: title + i18n: true + label: Title + widget: string + - name: category + i18n: true + label: Category + widget: select + options: ['Border Crossing and Working', 'Everyday Life and Return', 'Those Who Stay'] + - name: interviewee + i18n: duplicate + label: Who conducted the Interview? + - name: year + i18n: duplicate + label: Year + widget: datetime + date_format: MM.yyyy + time_format: false + format: MM.yyyy + - name: description + i18n: true + label: Short Description + widget: text + - name: story + i18n: true + label: Full Story + widget: markdown + - name: news + i18n: true + label: News + identifier_field: date + create: true + folder: src/content/news + fields: + - name: date + i18n: duplicate + label: Date + widget: datetime + date_format: MM.yyyy + time_format: false + format: MM.yyyy + - name: post + i18n: true + label: Post + widget: markdown + - name: pages + i18n: + structure: single_file + locales: [en, es, pt] + label: Pages + create: false + files: + - name: about + label: About Page + file: src/content/pages/about.md + slug: about + fields: + - name: thumbnail + label: Header Image + widget: image + - name: email + label: Contact Email + widget: string + default: mmp-lamp@princeton.edu + - name: map + label: Map Page + file: src/content/pages/map.md + slug: map + fields: + - name: thumbnail + label: Header Image + widget: image + - name: map + label: Map Image + widget: image + - name: pub + label: Publication Page + file: src/content/pages/pub.md + slug: about + fields: + - name: thumbnail + label: Featured Image + widget: image + - name: news + label: News Page + file: src/content/pages/news.md + slug: news + fields: + - name: thumbnail + label: Featured Image + widget: image + - name: home + label: Home Page + file: src/content/pages/home.md + slug: about + fields: + - name: thumbnail + label: Featured Image + widget: image + - name: staff + label: Staff Page + file: src/content/pages/staff.md + slug: staff + fields: + - name: thumbnail + label: Featured Image + widget: image \ No newline at end of file From 79bbeffbee7329b863d23355964ed98855073603 Mon Sep 17 00:00:00 2001 From: Heather Yu <35639529+hetd54@users.noreply.github.com> Date: Mon, 4 Mar 2024 10:49:10 -0500 Subject: [PATCH 2/3] chore: remove i18n at field level Users of our site would like to set up everything in english and then hire translators for various locales. StaticCMS requires a minimum of two locales to be declared in the i18n section of the config, so english-only would not be an option; additionally, setting any field as "i18n: true" REQUIRES translation. Removing these field declarations maintains the folder structure we need. --- public/admin/config.yml | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/public/admin/config.yml b/public/admin/config.yml index 99ef4ea..5a5722c 100644 --- a/public/admin/config.yml +++ b/public/admin/config.yml @@ -12,17 +12,14 @@ i18n: default_locale: en collections: - name: people - i18n: true label: People folder: src/content/people create: true fields: - name: name - i18n: true label: Name widget: string - name: title - i18n: true label: Title widget: string - name: avatar @@ -30,7 +27,6 @@ collections: label: Photo widget: image - name: org - i18n: true label: Company/University widget: string - name: address @@ -62,14 +58,12 @@ collections: time_format: false format: yyyy - name: pubs - i18n: true label: Publications folder: src/content/pubs create: true slug: '{{year}}-{{month}}-{{day}}_{{title}}_{{slug}}' fields: - name: classification - i18n: true label: Classification widget: select options: [ 'Book', 'Chapter', 'Article', 'Dissertation' ] @@ -82,17 +76,15 @@ collections: label: Link to Publication widget: string - name: data - i18n: true label: Data create: true folder: src/content/data fields: - name: title - i18n: true label: Title widget: string - name: description - i18n: true + label: Description widget: text - name: file @@ -100,18 +92,15 @@ collections: label: File widget: file - name: cat - i18n: true label: Category widget: select options: ['Study Design', 'Questionnaire', 'Changes to Questionnaire', 'Code Book', 'Appendices'] - name: graphs - i18n: true label: Graphs & Figures create: true folder: src/content/graphs fields: - name: title - i18n: true label: Title widget: string - name: year @@ -126,17 +115,14 @@ collections: label: Image widget: image - name: history - i18n: true label: Oral History create: true folder: src/content/history fields: - name: title - i18n: true label: Title widget: string - name: category - i18n: true label: Category widget: select options: ['Border Crossing and Working', 'Everyday Life and Return', 'Those Who Stay'] @@ -151,15 +137,12 @@ collections: time_format: false format: MM.yyyy - name: description - i18n: true label: Short Description widget: text - name: story - i18n: true label: Full Story widget: markdown - name: news - i18n: true label: News identifier_field: date create: true @@ -173,7 +156,6 @@ collections: time_format: false format: MM.yyyy - name: post - i18n: true label: Post widget: markdown - name: pages From 12d948fac461c307f05a63c661a1b369b8e6e03c Mon Sep 17 00:00:00 2001 From: Heather Yu <35639529+hetd54@users.noreply.github.com> Date: Mon, 11 Mar 2024 10:56:53 -0400 Subject: [PATCH 3/3] chore: remove pages from editable content --- public/admin/config.yml | 74 ++++------------------------------------- 1 file changed, 6 insertions(+), 68 deletions(-) diff --git a/public/admin/config.yml b/public/admin/config.yml index 5a5722c..a033a23 100644 --- a/public/admin/config.yml +++ b/public/admin/config.yml @@ -7,7 +7,7 @@ backend: media_folder: public/images i18n: structure: multiple_folders - locales: [en, es, pt] + locales: [ en, es, pt ] # The locale to be used for fields validation and as a baseline for the entry. default_locale: en collections: @@ -37,12 +37,12 @@ collections: i18n: duplicate label: Phone Number widget: string - pattern: ['^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$', 'Phone number must follow standard guidelines'] + pattern: [ '^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$', 'Phone number must follow standard guidelines' ] - name: email i18n: duplicate label: Email widget: string - pattern: ['.+@.+\..+', 'Email must follow standard guidelines'] + pattern: [ '.+@.+\..+', 'Email must follow standard guidelines' ] - name: startDate i18n: duplicate label: Year Started Contributions @@ -94,7 +94,7 @@ collections: - name: cat label: Category widget: select - options: ['Study Design', 'Questionnaire', 'Changes to Questionnaire', 'Code Book', 'Appendices'] + options: [ 'Study Design', 'Questionnaire', 'Changes to Questionnaire', 'Code Book', 'Appendices' ] - name: graphs label: Graphs & Figures create: true @@ -125,7 +125,7 @@ collections: - name: category label: Category widget: select - options: ['Border Crossing and Working', 'Everyday Life and Return', 'Those Who Stay'] + options: [ 'Border Crossing and Working', 'Everyday Life and Return', 'Those Who Stay' ] - name: interviewee i18n: duplicate label: Who conducted the Interview? @@ -157,66 +157,4 @@ collections: format: MM.yyyy - name: post label: Post - widget: markdown - - name: pages - i18n: - structure: single_file - locales: [en, es, pt] - label: Pages - create: false - files: - - name: about - label: About Page - file: src/content/pages/about.md - slug: about - fields: - - name: thumbnail - label: Header Image - widget: image - - name: email - label: Contact Email - widget: string - default: mmp-lamp@princeton.edu - - name: map - label: Map Page - file: src/content/pages/map.md - slug: map - fields: - - name: thumbnail - label: Header Image - widget: image - - name: map - label: Map Image - widget: image - - name: pub - label: Publication Page - file: src/content/pages/pub.md - slug: about - fields: - - name: thumbnail - label: Featured Image - widget: image - - name: news - label: News Page - file: src/content/pages/news.md - slug: news - fields: - - name: thumbnail - label: Featured Image - widget: image - - name: home - label: Home Page - file: src/content/pages/home.md - slug: about - fields: - - name: thumbnail - label: Featured Image - widget: image - - name: staff - label: Staff Page - file: src/content/pages/staff.md - slug: staff - fields: - - name: thumbnail - label: Featured Image - widget: image \ No newline at end of file + widget: markdown \ No newline at end of file