在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):max-barry/google-drive-cms开源软件地址(OpenSource Url):https://github.com/max-barry/google-drive-cms开源编程语言(OpenSource Language):HTML 42.0%开源软件介绍(OpenSource Introduction):Google Drive CMSNo longer maintainedSadly I don't have the time to maintain this project. It still works well, but I don't have the free time to support it. I would also recommend projects like Prismic.io and Contentful that tackle similar problems. A content management system (CMS) built on an interface everyone understands. IntroductionThe Google Drive CMS uses a combination of Google Sheets and Google Docs to maintain content on a website. These documents are sent to a site or a supporting service (e.g. a Firebase database) via a POST request to an API the admin specifies. The only requirements to run the Google Drive CMS are:
It is possible to run the CMS without writing server side code at the chosen API endpoint. The CMS' content can be exported as a JSON file, or it can be added directly to any PAAS databases that expose an API. An example of using Firebase to create the latter of these flows can be found on our examples page. Practical examplesThe following scenarios are good use cases for the Google Drive CMS:
InstallationTo begin using the Google Drive CMS you need a copy of the core template. This core template contains the default configuration settings and the Google Apps Scripts that live under the hood of the Google Drive CMS. To get a copy of the core template there are 3 options:
After creating a copy of the core template, change the endpoint value within the SETTINGS sheet. For more information on configuring your Google Drive CMS template, see the settings section of this documentation. Publishing contentThe Google Drive CMS will add a custom menu option to the top of the Google Sheets interface. The Google Drive CMS menu item contains two actions. Publish publishes the CMS' content to the designated endpoint Export content exports the contents of the CMS as a JSON file to a directory called Understanding the spreadsheetThe core template has four tabs. Each tab can be accessed from Google Drive's tab navigation toolbar at the bottom of the page. CMSThe main tab where an admin inputs their data. HeadersThe top row of the CMS tab represents the content's headers. These are used as the keys to map the content's data against in the JSON object sent to your endpoint. Headers behave similar to column names in a standard database. Field typesField types let admins add special functionality to a column. There are three field types, currently:
n.b. A blank field type will behave like a simple field. We are looking to add more in the future, including foreign key relationships between multiple sheets. Eval is a good stopgap for more complex data, as it can accept raw JavaScript arrays or objects. Update Google Drive CMS now supports pointing at other Google Sheets to create neater nested objects. Content rowsEach row beneath the field types will become an object within the JSON array sent to the designated API endpoint. These are the equivalent of a record within a traditional database. For example, an individual blog post is a content row, and it might have headers like "title" or "publication date". SettingsThe SETTINGS tab within the Google Drive CMS template allows customization the CMS' behavior. The following settings can be configured:
_internalsIt might be best to just leave this alone. Values in this tab power current and future functionality at a low level. Advanced featuresNested dataNEW
Use a field type of
Any data in the second spreadsheet will be added to your JSON payload as a nested array. ExampleGoogle Sheet A (your Google Drive CMS instance)
Google Sheet B (the data you want to nest)
Result
You could probably nest sheets within sheets within sheets. That would probably work. Don't point spreadsheets at each other. That's going to end in a loop. That would probably be bad. Rich textIt is possible to combine the Google Drive CMS core template with Google Docs to give an admin a rich text editor. Write a standard Google Doc using Google Doc's built in rich text capabilities (headings, links, inline imagery, etc.). Give that doc share settings that would allow the owner of the CMS core template at least view access. Add just the URL of that Google Doc to a cell within a content row of the CMS, and when published the Doc will be transformed in to raw HTML tags and added to the JSON payload. Google Docs are structured such that they can be exported straight to HTML. The CMS performs light sanitization of the converted HTML, but otherwise it is returned as a string within the JSON document upon publishing. Image replacementImages inserted in to Google Docs are hosted on Google's CDN. When the rich text is extracted you'll have To get around this Google Drive CMS provides support for externally hosted images. In your rich text Google Doc that is being consumed by the drive CMS add the following inline:
When the rich text is extracted and posted to your JSON api your SlugifyA common CMS requirement is a slug field. A slug field can be used to build URLs on a site, and is often a concatenation of a title field with hyphens. For example, a news article called "Big Announcement Coming" would have a slug of "big-announcement-coming". To expedite this process the Google Drive CMS has a shortcut function called SLUGIFY. Add the cell function Best practicesSecuring the CMSConsider access to the Google Drive CMS spreadsheet like the password and email logins for a traditional CMS. If you wouldn't want someone in your WordPress, don't share them access to your spreadsheet! To better understand the security and sharing potential of Google Drive, check out Google's documentation. If sharing the CMS spreadsheet with other admins, consider locking down parts of the document using protected ranges. For example, protect the headers row of the spreadsheet to prevent another admin breaking a data structure the API endpoint requires. Revision historyAdmins can rollback to previous iterations using Google Drive's built in revision history. Restore a previous version of the sheet and then republish the document. Extending the CMSAll of the Apps Scripts that power the CMS are baked in to the sheet an admin edits. These scripts can be accessed via |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论