How to store content for a site in separate files
Often site owners do not think about how to properly store content for a site, they write it directly on the site in a visual editor. However, this is not the best way, since in order to back up data, all content must be stored in a single standardized format separate from the site, which is easy to produce, edit, store and, if necessary, import content to the site.
In this case, the content will be stored not only in the site database and in the site file system, but also in universal files. Such files can be easily imported into any information system.
The most convenient format for writing articles for the site is the format of office documents - DOCX. In fact, this is just an archive, device DOCX format and how to open it is described in other articles.
The file itself must consist of pre-compiled sections, for example, at the top of the file there is a table with a description of the material:
- meta tags (minimum keywords and description), etc.
Next, content is placed directly, which usually contains different types of data:
- other objects.
When the material is written, the file can be easily imported to the site, for this it must be able to do so.
The system must be able to check whether a material exists with this name and type - if so, the material will be updated, otherwise it will be added. The program code usually includes an XML parser that is able to recognize not only content elements, but also their styles for quick transfer to the site. Do not forget about extracting images from DOCX into site folders so that they can be displayed on the site in the material just written. More detailed details of the work of importing content to the site from files will probably be discussed in other articles.
In conclusion, it remains to rename the DOCX file to the name of the article and save it to a specially prepared folder on a computer or other medium, where all data for a specific site is stored. For convenience, such a folder may contain subfolders named by dates in the format: 01.20, where 01 is the month, 20 is the year.
Accordingly, articles written this month can be added to each such folder. Such placement will make it easy to navigate a huge number of articles and, if necessary, find the right one. This is how a site content collection can be organized.
The ease of writing and publishing content on the site, as well as properly structured content storage will serve as an additional motivation to constantly replenish your collection with new articles. After all, to write an article, it will be enough to complete only two steps:
- open a sample DOCX article and write a new article based on your imagination and operating data (of course, if necessary, you may still have to spend time on making images in a graphic editor for an article, or you can just take screenshots);
- go to the site and import into the system (if necessary, for quick indexing, you can also inform the search engines about a new article).
Thus, keeping content separate from the site is a very important part of working on your project. Only this approach will allow you to quickly and easily develop, update and store content for the site. Moreover, the DOCX format is universal, you can develop a parser for any system on which the site is running.
- 09.07.22IT / Misc Convert office files DOC, DOCX, DOCM, RTF to DOCX, DOCM, DOC, RTF, PDF, HTML, XML, TXT formats without loss and markup changes
- 07.07.22IT / Safety How to protect PHP, JS, HTML, CSS source code - obfuscation, minification, compression and encryption
- 06.07.22IT / Safety Connection not secure, problem with Lets Encrypt - how to fix expired 09/30/2021 DST Root CA X3, remove it manually and install ISRG Root X1. Example on MS Windows 7
- 08.07.21IT / Misc How to make a free translation for a website without an API, translate documents in Google Translate
- 06.07.21IT / Misc How to make a subscription button on a website, a subscriber base and automatic mailing