BoxLang ๐ A New JVM Dynamic Language Learn More...
A skeleton Preside application to be used as a starting point for a blog.
This package should be installed using the preside new site
command from CommandBox rather than directly. See PresideCMS Commands.
There are three dependencies in form of preside extensions that are automatically setup for you via CommandBox box.json
To get you up and running quickly here is a sample scenario of what you would do to start using the blog:
Use CommandBox to setup your site
mkdir myblog --cd
preside new site
Follow the wizard, use for example:
Create an empty database schema in mysql or mariadb that we can use.
Install and start ElasticSearch as described here: https://www.elastic.co/guide/en/elasticsearch/reference/1.7/_installation.html At this point the ElasticSearch extension only works with a 1.7 release, but that might change later. If you don't want to use a search engine you can skip this step. But you need to disable the extension later - otherwise you get into trouble. Disabling it is describe further down below.
Use CommandBox to start the server (make sure that you are in your blog apps root dir)
preside start
Setup MySQL datasource now [Y/n]? y enter DB info (name, user, server, etc.)
You should now see a blank homepage.
Access the Preside Admin by appending /admin to the URL, e.g. http://127.0.0.1:12345/admin If you chose a different admin path in the wizard, append that accordingly. If you forgot what admin path you took or want to change it now, you can do that in the Config.cfc of your project.
Setup the sysadmin (super user that can do everything in the admin) by entering an email address and password. Login using username sysadmin and the password you just entered
If you decided not to use elastic search (not recommended though), now it's time to disable the extension. Open the developer console in the Preside admin (english keyboard: `, german keyboard: CTRL+SHIFT+ยด < that is the accent next to the backspace, your keyboard: no idea ;-) )
extension list
extension disable preside-ext-elasticsearch
extension list
reload all
You should then reload the page in the browser and the extension is now disabled. An alternative way to do the same is to edit the extensions.json file in your application and reloading the application afterwards. An alternative way to reload the application is to add ?fwreinit=true to the URL.
If you did not disable ElasticSearch, we are now configuring it. In the Preside Admin go to System > Search Engine > ElasticSearch Settings
To make sure that the elastic search extension works as expected, add a test page in the site tree or edit the homepage there. If it does not throw an error on save, it should work fine in theory. Have a look under System > Search Engine. The index should be listed there and you should be able to refresh it manually. There is no need to do this manually all the time as on each page save the page content is indexed automatically. If you get errors on save of a page, reload the application and try again.
Now we need some further settings to have your blog work nicely
Use AddThis.com to add social sharing buttons to your blog posts. Create an account there, take note of the generated ID and enter it afterwards in the Preside Admin here:
System > Settings > AddThis Social Sharing
Use disqus.com for discussion threads/commenting on your blog posts. Create an account, configure it and take not of the short name, entering it afterwards in the Preside Admin here:
System > Settings > Disqus Comments > Disqus Short name
You can setup google analytics for tracking but also make use of it to import the page views. Those can then be used, e.g. to display a list of blog posts having the most viewed ones on top. Getting the required infos from GA is kind of tricky and described here:
https://bitbucket.org/jjannek/preside-ext-analytics-import
Enter the necessary settings here:
System > Settings > Google Analytics Reporting Import
Head over to the Data Manager in the Preside admin and enter some basic data
All those can also be entered/edited/updated on-the-fly while using them later, but it might be less confusing to do it step by step.
Add a new page as a child of the Homepage by clicking the plus next to it. Choose "Blog" from the available options. Fill in the basic blog data:
Then save + publish.
Edit the just created Blog page again and have a look at the sidebar content field. It's empty and we put 3 widgets in there (widgets can be added with the magic wand button in the rich editor):
then save + publish.
It was required to save the page first as it is referenced in the widgets.
To customize the footer of the website, we can do the following:
Within the Preside admin go to Default Site > Manage sites and then edit the default site. Open the Navigation tab and do the following:
Go to the site tree and beneath the created blog page, click the link manage blog post pages. Then click the button add blog post.
Fill in the following details:
Then save + publish
Have a look at the frontend website and if everything works as expected.
Go to the Preside admin and navigate to System > Task Manager.
There you will find an import task. For now just try to run it manually and have a look if everything works as expected. Later on you can edit the configuration there to automate the import.
Have fun trying out Preside goodness, explore the existing code and customize to your desire.
Feel free to fork and contribute. Feedback is welcome - probably best on the Preside Slack.
$
box install preside-skeleton-blog