Getting Started With Ghost Sample Chapter
Getting Started With Ghost Sample Chapter
Kezz Bracey
David Balderston
Andy Boutte
Chapter No. 1
"The First Steps with Ghost"
The second goal, though not something Ghost explicitly sets out to do at its inception,
is to usher in a new wave of support for JavaScript-powered web applications built on
Node.js. It's very likely that Ghost will act as a driving force that helps take us from
the age of PHP (the dominant language of web platforms) to a new paradigm of lightning
fast JavaScript and Node.js-driven apps. Just as WordPress propelled the uptake of PHP
in its early days, so too may Ghost propel the uptake of Node.js and JavaScript-powered
web development.
JavaScript- and Node.js-based apps have been building in popularity in the technical
world for some time due to the plethora of advantages they bring, not least of which is
speed. Many people consider that PHP is on the downward slope of its dominance while
Node.js continues to be one of the fastest growing platforms online. Additionally, we are
seeing more and more technologies making a general shift of focus towards JavaScript.
Even WordPress, arguably the biggest PHP project there is, has been gradually rolling
out increasing numbers of JavaScript-driven features. All things point to JavaScript and
Node.js as being the way of the future.
Until now, the relative newness of Node.js-based technology has meant the average
blogger or website builder has not been able to partake in these advantages. Arguably,
the major roadblocks to enabling people to access the perks of Node.js apps have been
the limited availability of hosting and the technical expertise required. Ghost has shaken
that stagnation up thoroughly.
The sudden demand for Ghost support has reached the ears of many hosts. In just a few
short months, we have seen new automated Ghost installers pop up, hosts that previously
didn't support Node.js setting up services to make Ghost installation easy and brand new
hosts specializing purely in Ghost have also emerged. These developments have opened
previously non-existent doors to the very latest and most powerful technologies in a way
that's accessible to any user no matter what their level of experience.
Ghost is arguably the first in this new generation of web technology to reach widespread
public consciousness, bringing with it a wave of new possibility. If web applications of
the past could be paralleled with dial-up internet, then we might draw the comparison
that Ghost aims to be lightning fast broadband. Where other platforms may grow to
accommodate a myriad of use cases, Ghost sets out to remain focused on doing a single
job cleanly and efficiently.
This book is designed to show you exactly how to get started with Ghost. You'll learn
everything there is to know about using Ghost from working with the admin interface to
creating content. You'll get the information you need to choose the right automated Ghost
install equipped hosting for your needs. You'll be guided through the more technical
processes of manual installation on self-managed servers and local environments. And
you'll learn how to design and code your own Ghost themes from scratch, whether for
your personal use or to sell in the Ghost marketplace.
By the end of this book, you'll be ready to jump head first into the exciting new world
of Ghost!
[8]
Chapter 1
Ghost(Pro) does not allow backend access to your files, but is rather designed to offer
the most streamlined service. This means that if you want to set any customized
configurations, or make any major changes on the backend, you will not be able to.
This is usually not a problem, because most users just want a reliable platform to
host their blog, without too much extra customization. As you grow in confidence
with managing your Ghost blog, you may choose a different hosting option, allowing
you to tinker with code and use custom settings. Chapter 2, Manual Installation and
Configuration of Ghost, will help you along if you decide to delve deeper!
Ghost(Pro) also provides the ability to point your own domain, or subdomain,
at your Ghost blog. Full instructions on how to go about that can be found at
https://ghost.org/blogs/domains/#setup, when logged into Ghost.org.
Adding a custom theme only requires going to the Settings section of your My Blogs
dashboard, browsing for a theme ZIP file on your computer, and then saving your
settings. The theme will then be applied to your blog automatically with no further
steps needed.
Pricing to host on Ghost(Pro) starts at $10 per month for a single blog
with up to 25,000 views/month. All the plans are monthly plans with
no long-term commitments necessary.
For Ghost's full pricing chart visit https://ghost.org/pricing/.
And to register a new account at Ghost.org go to https://ghost.org/.
[9]
Some hosts will take care of this user account setup as part of the installation
process, but most will not.
The minute you have finished your installation, you should go to:
http://<yourdomain.ghost.io>/ghost/signup/, which will look
something like the following screenshot:
Once there, fill in your name, e-mail address, and password and then click on
SIGN UP to create your user account.
You must complete this step immediately because until you do that, the form
will be open for anyone to come along and create a user account.
Now that your account is created, go ahead and log in.
[ 10 ]
Chapter 1
Configure settings
After you've logged into your account, you're ready to configure some basic settings.
The available settings are very simple, so there's not a lot you'll need to do at this stage.
Ghost currently has two settings areas: General and User. Both the settings can
be accessed via the Settings tab in the top admin menu. The panels are both fairly
self-explanatory, so this will be a brief overview to point out the various features.
General settings
Let's first have a look at the general settings:
[ 11 ]
Blog Title: This will be used by most themes in the header as well as
sometimes in the footer. Ghost will also output your Blog Title in your
site's <title> tags.
Blog Description: This will also tend to appear in the header of most
themes. Ghost will output your Blog Description in the description
metatag of your site.
Blog Logo: The blog logo is typically positioned in the header or the top
of the sidebar in most themes. To add a custom logo, click on the green
Upload Image button next to the Blog Logo label.
Blog Cover: Not all themes use the blog cover image, but those that do,
tend to use it as a background for large headers or as the background for
the entire site. To add a custom block cover image, click on the green
Upload Image button next to the Blog Cover label.
Posts per page: This can be set to determine how many posts a user can
see before needing to click through to the next page. This affects post
listings on the home page and on tag pages.
Dated permalinks: If checked, this option will add the date of publishing to
post permalinks in the <yourdomain>.com/YYYY/MM/DD/post-title/ format.
Theme: This option will allow you to choose from any themes that were in
your blog's content/themes directory when it was last started up. Note that
new themes uploaded to this directory won't be seen until Ghost is restarted.
This area is not available on Ghost(Pro), where themes are
added via the Settings section for each blog instead.
After making any changes to these settings, click on the blue Save button in the
top-right corner of the screen.
User settings
This section has two main purposes. One is to give you the ability to change your
password; you'll see the fields that allow you to do so at the bottom of the page. The
other is to enter information that your theme can display in the author profile area
on single posts of your blog.
[ 12 ]
Chapter 1
Author Image: In the little circle at the top-left of the user settings, you'll see
the author image. To add your own, click on this circle and an uploading
window will appear.
Author Cover: This is an image similar to the Blog Cover image that can
be used by the theme on single posts. It would seem likely that this image
may be designed to appear on author profile pages once their functionality
is included in Ghost. Click on the Change Cover button in the bottom-right
corner of the cover image preview to change it.
Author Name: Fill in the name here that you'd like to have displayed
publicly as the author of your posts.
Email: This is a required field; however, it can use a different e-mail address
than your main admin e-mail. Be aware that this address may be displayed in
your author profile on some themes.
[ 13 ]
Location: Again, the location you enter here will appear in your author
profile area should you want people to know where you live. If not, leave
this blank.
Website: Add the URL of any other website of yours you'd like people to
know about. Most themes will include a hyperlinked display of this URL
in the author section of your single posts.
Content management
The post management process in Ghost is very smooth and simple. In this section,
we'll cover the essentials of post management, as well as a couple of features you
might need a little more help finding than others.
[ 14 ]
Chapter 1
Down the left-hand side you'll see a list of all the content that has been added to your
blog so far. On a new site, this content is always the default "Welcome to Ghost" post.
On the right you'll see a preview of whichever post is currently selected from that list.
To delete a post, first select it from the list from the left-hand side panel by clicking
on its title. Then click on the small grey gear icon in the top right of the post preview
and click on Delete This Post at the bottom of the menu that pops up.
Additionally, if the theme has any special formatting in place for the appearance of
pages, it will be activated. How this presentation differs will depend on the theme
you are using.
To convert a post into a page, click on the same gear item you would when deleting
a post and then check the Static Page box. Ghost will detect that the box has been
checked and automatically convert the post to a page.
[ 16 ]
Chapter 1
Featured posts
It's also possible to set specific posts to the Featured status. This adds a .featured
class to the post that a theme may use to style featured posts in a different way, and
also makes it possible for a theme to separate them into their own display area. (How
this is done will be covered in Chapter 5, Applying Design Choices and Visual Styling).
To set a post to the Featured status, click on the grey outlined star in the top left of
the post preview. When the status is successfully changed to Featured, the star will
be filled in grey.
[ 17 ]
Ghost displays the actual editing space on the left-hand side of the screen. This is
where you'll type in your content. To the right, you'll see a real-time preview of your
content. As you scroll up or down in your editing space, the preview on the right
will automatically scroll to the same position, making it very easy to visualize your
content as your blog readers will see it.
At the moment, the content preview uses a default set of styles to determine
its appearance. In the future, styles will be drawn from the active theme, so the
preview looks exactly as the post will when published.
[ 18 ]
Chapter 1
To set a new title, or edit an existing one, simply type whatever you wish into
this field.
Saving a draft
One of the first things you will want to do, typically as soon as you've typed in your
new post's title, is save your draft. To do this, click on the blue Save Draft button in
the bottom-right of the screen. You can also use Ctrl + S.
Adding tags
To add tags to your post, locate and click on the small grey tag in the bottom-left
corner of the interface. A cursor will appear and you can type in the tag you wish
to apply.
When you have finished typing the tag name, press Enter and your text will be
converted into a tag as shown in the following screenshot:
You can repeat this as many times as you wish. The tags that are applied to your
post will appear in the single post view and, as of Ghost 0.5.0, each tag will have
its own archive page.
[ 19 ]
Click on PUBLISH NOW and the menu will close, converting the previously blue
button into a red one reading PUBLISH NOW:
[ 20 ]
Chapter 1
Click on this red button and your post will be published live on the frontend of
your blog.
After you have done this, the button will be converted again, back to its former
blue color and now reading UPDATE POST:
If you make any edits after publishing, just click on this button to push them to
your live post.
Should you need to unpublish the post, the process is essentially the same as for
publishing the post. Again, click on the small arrow to the right of what is now
the UPDATE POST button and the following menu will pop up:
This time select UNPUBLISH and the button will turn red, now displaying
UNPUBLISH:
Click on the red button and your post will no longer be publicly visible while the
button will return to its original blue SAVE DRAFT state.
[ 21 ]
[ 22 ]
Chapter 1
But with Ghost, none of this is necessary. You simply enter a single # character at the
start of your line and it will present as H1 text.
This means no pauses to take your hands off the keyboard and work with the mouse
or interface buttons. Everything becomes a part of a smooth typing process.
At first glance, this may not seem like a huge time saver in itself; however, in
application, doing almost everything via the keyboard, without having to pause and
mentally change gears to use the mouse, means that you will be able to maintain much
greater focus on your writing. Hence, the overall time you save will amount to much
more than just the time no longer spent using the mouse.
This example from the Ghost homepage shows just how easy it is to generate some
of the most common formatting requirements using Markdown:
Using Markdown, you can perform the following actions in your Ghost posts:
Bold text
Italicize text
Add links
Insert images
Add blockquotes
For a full breakdown of Ghost Markdown syntax and the keyboard shortcuts you
can use to make insertions even faster, please refer to Appendix, Markdown Syntax
and Ghost Shortcut Keys.
To learn more about Markdown visit http://daringfireball.net/projects/
markdown/.
Image upload
Inserting images is one of the few things you'll use the mouse for when creating
Ghost content. The good news is the process is cleverly structured ensuring you
don't have to break your writing process to do so until the end.
When you first insert your image markdown, by either pressing Ctrl + Shift + I
or typing , a placeholder image will be added into your post
preview, as shown in the following screenshot:
When you know you want an image at a certain position in your post, you can go
ahead and add a placeholder then continue on with your writing without a pause in
your flow. Then after you're finished writing, you can come back and add images to
your post.
This process of adding images where placeholders are positioned is also very easy,
with two methods to choose from. You can either click on the placeholder image
and have it open up a window where you can browse for your image file, or you
can drag-and-drop a file directly onto the placeholder to upload.
[ 24 ]
Chapter 1
Inline HTML
On top of its ease of use, one of the beauties of a Markdown-based post editor is you
can also place raw HTML straight into your post and it won't be stripped out. If there's
something you need to do in your post that doesn't have associated Markdown syntax,
you can just add in the code you need directly.
One of the best applications of this is the insertion of videos. You don't need any
plugins or an extra functionality to place videos from the most common sites into your
post. Just copy the iframe embed code they provide you, such as the type you would
get from YouTube, for example, and paste it straight into your post.
[ 25 ]
DigitalOcean
DigitalOcean is a Virtual Private Server (VPS) hosting company with a one-click
Ghost installation. They have taken the code provided by the Ghost team and
integrated it with their own hosting platform. DigitalOcean runs all of their website
hosting on Solid State Drives, which helps make the VPS servers run even faster and
decrease your page load times. The greatest benefit of hosting on DigitalOcean is that
not only is your Ghost blog live almost immediately, but you also get full access to
the server on which it runs.
What this means is that you can access the server and make any changes you want.
For instance, if you would like to host a second Ghost website on your server, you
have the power to do that. Likewise, if you want to make special configurations or
update to their latest nightly version of the code, you can do that as well. While it is
not necessary for you to access the server to run your Ghost blog, having the ability
to do so is a useful feature. With DigitalOcean, you have to update to the new Ghost
software manually, but this should be very easy going forward.
DigitalOcean has played a big part in the Ghost community, even before Ghost was
released to the public. The fact that they have an instant install of Ghost, as well as
allow their users to have backend access to the server, makes them an outstanding
option to host your Ghost blog. DigitalOcean is actually the company that we use
to host all of our blogs.
The way DigitalOcean works as a service in general is to provide what they call
"droplets". Droplets operate as self-contained servers, which means that they give
you control over everything from your choice of operating system, for example
Ubuntu and CentOS, to security, which coding languages are supported, and
so on. When you purchase a new droplet, everything is installed fresh from the
operating system and up. The process of installing Ghost on DigitalOcean is fairly
simple, but we have created a step-by-step guide that you can find at http://www.
howtoinstallghost.com/how-to-install-ghost-on-digital-ocean-vps/.
You can get a DigitalOcean VPS with Ghost and one terabyte of traffic for $5
a month.
The Ghost image from Digital Ocean will set your new droplet up with Ubuntu
12.04 as an operating system, with Ghost preinstalled and ready to go. After
registering and creating a new droplet, you'll have the choice to select an image
under Applications. Choose the Ghost on x.x.x 14.04 image and the setup will be
handled for you. You'll be able to access your blog immediately via the IP address
allocated to you by DigitalOcean.
[ 26 ]
Chapter 1
You should be prepared for the fact that setting up a custom domain name to point
at your site and handling updates is a little more involved as you'll need to work
with command line via an SSH client such as Putty (http://www.putty.org).
If command-line server management is something you're already
comfortable with or intend to learn, there is assistance available via the
following tutorial written by Ghost's own lead developer Hannah Wolfe
at https://www.digitalocean.com/community/articles/howto-use-the-digitalocean-ghost-application.
Amazon EC2
Amazon offers a cloud hosting service called EC2. With EC2, anyone can launch a
cloud-based server. The best part is that, with a new Amazon AWS account, you can
host what they call a "Micro" instance, which allows you to run Ghost, free of charge
for one year.
EC2 has a marketplace where individuals and companies upload pre-made images
of software for users to launch and use for themselves. If you visit the marketplace
and search for Ghost, you will see that there are already images ready to use. This
makes installing Ghost extremely simple. All you need to do is launch your own
instance of the image and Amazon will provide a URL to visit, and your Ghost blog
is up and running.
As EC2 is a virtual server, you have backend access to your Ghost blog. This allows
you to make any changes on the backend that you would like; however, because the
image you used already has Ghost installed and running, you do not need to access
the backend if you so choose.
The only downside with using EC2 is that as Ghost and other server software do not
update automatically; you are responsible to make updates as needed.
Because the microtier is free, Amazon EC2 is a great way to try out Ghost. EC2 has
been an extremely popular way for people to host their Ghost blog, and there is no
reason not to try it out.
We maintain an image of Ghost to facilitate the automated installation
of it, to offer an easy place to try out Ghost for free. There's more
information and instructions at http://www.howtoinstallghost.
com/how-to-setup-an-amazon-ec2-instance-to-hostghost-for-free/.
[ 27 ]
Summary
That's it. You've just taken your first steps with Ghost!
You now have all the information you need to choose the host that best suits your
needs. You know what to do immediately after installation and can navigate Ghost's
admin interface. You can configure your Ghost settings, manage your content, and
work with the post editor. You should also have a basic grasp on the concept of the
Markdown syntax.
If you've made your decision, and want to go with Ghost(Pro), and now want to
customize your Ghost blog's look and feel, you will also need to install a copy of
Ghost on your computer, ready for theme development. Head to the next chapter
where we cover how to install Ghost locally.
[ 28 ]
Alternatively, you can buy the book from Amazon, BN.com, Computer Manuals and
most internet book retailers.
www.PacktPub.com