Ubud Documentation
Current Version:1.0.1 - 05 March 2021
Changelog →
👋 Theme Editing & Tools
Edit the theme files mentioned here with your text editor of choice. For example, you can use Visual Studio Code ↗ or Sublime Text ↗.
Once you finish making your changes, zip the theme files, and upload the final zip file to your Ghost website.
If you are looking for Ghost hosting, I recommend Ghost(Pro) ↗.
Watch the following short video tutorial about theme editing.
Table of Contents
- Theme Installation
- Upload the routes.yaml File (⚑ Required)
- Homepage
- Homepage Content
- Homepage Default Style
- Homepage Styles Change Overview - Video
- Homepage Image Right Style
- Homepage Image Circle Style
- Homepage Image Center Style
- Homepage Image Wide Style
- Homepage Image Full Style
- Homepage Number of Posts
- Homepage Change Featured and Recent Posts Titles
- Homepage Styles and File Names
- Homepage Remove the Featured Posts Section
- Homepage Remove the Recent Posts Section
- Homepage Remove the All Posts → Link
- Homepage Remove the Bottom Subscribe Box
- Changing Colors with CSS Variables
- Members / Subscriptions
- Remove ‘Log in’ and ‘Membership’ links from Header
- Remove ‘Public’, ‘Members’ and ‘Paid’ Labels from Post Card
- Remove Subscribe Form from the Post Page
- Edit Plan Features
- Add Free Plan Column to Membership Page
- Add Custom Excerpt for Members Content with Gradient Style
- Membership Troubleshooting Tips
- Navigation
- Pages
- Languages
- Comments
- Posts Per Page
- Google Analytics
- Update Favicon
- Responsive Tables
- Social Sharing Icons
- Syntax Highlighting
- Theme Deploy with GitHub Actions
- Code Injection
- Customize Logo Size
- Remove Dates
- Changing Theme Font
- Theme Development
- Theme Update
Theme Installation
The first step is to unzip the downloaded package. Inside the new directory ubud, you will find the zipped theme and a documentation file.
Follow these steps to upload the theme to your blog:
- Log in to your Ghost website admin (example.com/ghost).
- Click Design in the left-side menu.
- Scroll down to the INSTALLED THEMES section.
- Click Upload a theme.
- Select the theme file (ubud.zip).
- Once uploaded, click Activate now to activate the theme immediately. If you want to activate it later, click Close.
Or watch the following video for theme installation.
Upload the routes.yaml File (⚑ Required)
The routes.yaml
is required for the following reasons:
- Members and subscriptions flows
- Homepage content and layout style
- Blog page
- Archive page
To upload the file, follow these steps:
- Unzip the
ubud.zip
theme file. - Go to the Labs page in Ghost admin (
/#/settings/labs
). - Scroll down to the Routes section and click the Upload routes YAML button.
- Select and upload the
routes.yaml
file inside the theme zip file.
Or watch the following video for installation.
Note: upload routes.yaml after uploading the theme zip
There will already be a default routes.yaml
file uploaded to Ghost. You need to upload your theme’s routes.yaml
to override the default.
Do this separately after uploading your theme zip file.
Homepage 404: Page Not Found
After uploading the routes.yaml
file, the homepage will return 404 Page Not Found.
That’s fine. Move on to the next step and set up the Homepage.
Homepage
Make sure to Upload the routes.yaml file.
The homepage will show a list of content sections.
- Your content and image from a custom Ghost Page
- Featured posts, if they exist
- Recent three posts
- All Posts → link to the blog page
- Subscription box
Homepage Content
In Ghost admin, create a new Page.
From the Page settings, make sure that the Page URL setting is home
.
Add your content, upload your image, and publish the page.
The page title will not be visible on the website; only the content and the image will be. However, you can name it Home or any preferred name to make it visible from the dashboard.
If you don’t want to upload an image, you can leave it empty, and the theme will only show the page content on the homepage like the following example.
Now, go to your website homepage, and you will see your content is visible using the theme homepage default layout style.
Watch the following video for the homepage setup.
Note
The homepage Metadata information will be coming from the website General settings due to a Ghost limitation not exposing the custom homepage data.
I would recommend setting up the website following settings from General settings admin page.
- Title & description
- Publication cover to be the same as the homepage featured image if you already uploaded one
Metadata is useful for Search Engine Optimization and sharing your website on social media sites to have a nice looking preview.
Homepage Styles Change Overview - Video
Watch the following short video to overview the available theme homepage styles and how to change them.
Homepage Default Style
The theme file for the home default style is home.hbs
if you want to make any changes.
Homepage Default Style Image Size
The image size is 540px
wide.
When uploading the Featured image, try to upload an image with a double size to look sharp in retina displays. The 540px
wide size is the one that is visible on the screen. But behind the scenes, the theme will crop the image to be 1080px
wide if the uploaded image is broader than that. Again, I use this method so the image looks good on retina screens.
Homepage Image Right Style
The theme file for the home image right style is home-image-right.hbs
if you want to make any changes.
To activate the Image Right style:
- Open the
routes.yaml
theme file - Comment the
- home
line by adding#
in front of it. - Uncomment the
- home-image-right
right by removing the#
in front of it.
The routes.yaml
will look like the following.
routes:
/membership/: members/membership
/signup/: members/signup
/signin/: members/signin
/account/: members/account
/:
data: page.home
template:
# - home
- home-image-right
# - home-image-circle
# - home-image-center
# - home-image-wide
# - home-image-full
/archive/:
template: archive
collections:
/blog/:
permalink: /{slug}/
template: index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
Save and Upload the routes.yaml file to your website.
Homepage Image Right Style Image Size
The image size is 540px
wide.
When uploading the Featured image, try to upload an image with a double size to look sharp in retina displays.
The 540px
wide size is the one that is visible on the screen. But behind the scenes, the theme will crop the image to be 1080px
wide if the uploaded image is broader than that.
Again, I use this method so the image looks good on retina screens.
Homepage Image Circle Style
The theme file for the home image circle style is home-image-circle.hbs
if you want to make any changes.
To activate the Image Circle style:
- Open the
routes.yaml
theme file - Comment the
- home
line by adding#
in front of it. - Uncomment the
- home-image-circle
right by removing the#
in front of it.
The routes.yaml
will look like the following.
routes:
/membership/: members/membership
/signup/: members/signup
/signin/: members/signin
/account/: members/account
/:
data: page.home
template:
# - home
# - home-image-right
- home-image-circle
# - home-image-center
# - home-image-wide
# - home-image-full
/archive/:
template: archive
collections:
/blog/:
permalink: /{slug}/
template: index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
Save and Upload the routes.yaml file to your website.
Homepage Image Circle Style Image Sizes
The image circle style comes with four different image sizes.
- Default:
96px * 96px
- Medium:
128px * 128px
- Large:
192px * 192px
- xLarge:
256px * 256px
When uploading the Featured image, try to upload an image with a double size to look sharp in retina displays.
The previous sizes are the ones that are visible on the screens. But behind the scenes, the theme is using the actual image size will be.
Again, I use this method so the image looks good on retina screens.
- Default:
192px * 192px
- Medium:
256px * 256px
- Large:
384px * 384px
- xLarge:
512px * 512px
The theme and Ghost will do the image crop and generate those sizes when you upload an image. I want to give you an overview of the dimensions.
To show different image size instead of the small and default one. Open the home-image-circle.hbs
theme file and replace line 9
with the following medium size line.
{{> home/home-image-ricle--medium }}
For the large size, use the following line.
{{> home/home-image-ricle--large }}
For the xLarge size, use the following line.
{{> home/home-image-ricle--xLarge }}
You can also watch the following short video for how to change the circle image size.
Homepage Image Center Style
The theme file for the home image center style is home-image-center.hbs
if you want to make any changes.
To activate the Image Center style:
- Open the
routes.yaml
theme file - Comment the
- home
line by adding#
in front of it. - Uncomment the
- home-image-center
right by removing the#
in front of it.
The routes.yaml
will look like the following.
routes:
/membership/: members/membership
/signup/: members/signup
/signin/: members/signin
/account/: members/account
/:
data: page.home
template:
# - home
# - home-image-right
# - home-image-circle
- home-image-center
# - home-image-wide
# - home-image-full
/archive/:
template: archive
collections:
/blog/:
permalink: /{slug}/
template: index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
Save and Upload the routes.yaml file to your website.
Homepage Image Center Style Image Size
The image size is 731px
wide.
When uploading the Featured image, try to upload an image with a double size to look sharp in retina displays.
The 731px
wide size is the one that is visible on the screen. But behind the scenes, the theme will crop the image to be 1462px
wide if the uploaded image is broader than that.
Again, I use this method so the image looks good on retina screens.
Homepage Image Wide Style
The theme file for the home image center style is home-image-wide.hbs
if you want to make any changes.
To activate the Image Center style:
- Open the
routes.yaml
theme file - Comment the
- home
line by adding#
in front of it. - Uncomment the
- home-image-wide
right by removing the#
in front of it.
The routes.yaml
will look like the following.
routes:
/membership/: members/membership
/signup/: members/signup
/signin/: members/signin
/account/: members/account
/:
data: page.home
template:
# - home
# - home-image-right
# - home-image-circle
# - home-image-center
- home-image-wide
# - home-image-full
/archive/:
template: archive
collections:
/blog/:
permalink: /{slug}/
template: index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
Save and Upload the routes.yaml file to your website.
Homepage Image Wide Style Image Size
The image size is 1120px * 630px
.
When uploading the Featured image, try to upload an image with a double size to look sharp in retina displays.
The 1120px * 630px
size is the one that is visible on the screen. But behind the scenes, the theme will crop the image to be 2240px
wide if the uploaded image is larger than that.
Again, I use this method so the image looks good on retina screens.
Homepage Image Full Style
The theme file for the home image full style is home-image-full.hbs
if you want to make any changes.
To activate the Image Full style:
- Open the
routes.yaml
theme file - Comment the
- home
line by adding#
in front of it. - Uncomment the
- home-image-full
right by removing the#
in front of it.
The routes.yaml
will look like the following.
routes:
/membership/: members/membership
/signup/: members/signup
/signin/: members/signin
/account/: members/account
/:
data: page.home
template:
# - home
# - home-image-right
# - home-image-circle
# - home-image-center
# - home-image-wide
- home-image-full
/archive/:
template: archive
collections:
/blog/:
permalink: /{slug}/
template: index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
Save and Upload the routes.yaml file to your website.
Homepage Image Full Style Image Size
The wider the image, the better. An image height of 676px
will be perfect.
Homepage Number of Posts
To control the number of featured posts, open the partials/home/featured-posts.hbs
theme file. Change the limit
value from all
to whatever number you want to show. For example, to show only three featured posts, use limit='3'
.
To control the number of recent posts, open the partials/home/recent-posts.hbs
theme file. Change the limit
value from 3
to whatever number you want to show. To show all the posts, use limit='all'
.
Homepage Change Featured and Recent Posts Titles
To change the Featured Posts title, open the partials/home/featured-posts.hbs
theme file and change it in line 10
.
To change the Recent Posts title, open the partials/home/recent-posts.hbs
theme file and change it in line 10
.
Homepage Styles and File Names
Blew are the homepage styles and theme file names for a quick overview.
- Homepage Default Style →
home.hbs
- Homepage Image Right Style →
home-image-right.hbs
- Homepage Image Circle Style →
home-image-circle.hbs
- Homepage Image Center Style →
home-image-center.hbs
- Homepage Image Wide Style →
home-image-wide.hbs
- Homepage Image Full Style →
home-page-full.hbs
Homepage Remove the Featured Posts Section
To remove the Featured Posts section from the homepage, open the theme file for the homepage style you are using. Then, remove the {{> home/featured-posts }}
line from that file.
Another option is to remove the Feature this post checkbox for each post on your website.
Homepage Remove the Recent Posts Section
To remove the Recent Posts section from the homepage, open the theme file for the homepage style you are using. Then, remove the {{> home/recent-posts }}
line from that file.
Homepage Remove the All Posts → Link
To remove the All Posts → link from the homepage, open the theme file for the homepage style you are using. Then, remove the {{> home/all-posts-link }}
line from that file, the line before the last line.
Homepage Remove the Bottom Subscribe Box
To remove the Subscribe Box link from the homepage, open the theme file for the homepage style you are using. Then, remove the {{> subscribe-box }}
line from that file, the last line.
Changing Colors with CSS Variables
Watch the following video to overview the color scheme feature and how to use it.
The theme file assets/sass/settings/colors.scss
contains the theme default color variables. They are exactly as the following.
:root {
--color-brand: #C5322E;
--color-text-primary: #181818;
--color-text-secondary: #687385;
--color-white: #FFFFFF;
--color-error: #CC3C64;
--color-success: #07815C;
--color-border: #ECECEC;
--background-primary: #FFFFFF;
--background-secondary: #F6F6F6;
--background-hero: var(--background-secondary);
}
Theme Colors Explained
It might seem complicated if you are not a technical person, but once you change one and get an instant result, you will get and feel it.
You can try the ready-made nine color schemes blew.
:root {
// The theme's dominant color; you can see it in buttons, header Membership link text, and content links hover interaction.
--color-brand: #C5322E;
// Primary text is the main text color for site content.
--color-text-primary: #181818;
// Secondary text is the color of elements like post date, footer nav, input placeholder, content captions for images and galley, for example, and author information block icons and metadata.
--color-text-secondary: #687385;
// White color used for buttons with the brand colors as a background. Also, used for the notification element, you can see at the site top when someone confirms a subscription.
--color-white: #FFFFFF;
// Color error is used for the error message that comes when something wrong happens while subscribing. Also, used as a background for the error notification.
--color-error: #CC3C64;
// Color success used for the success message comes when something wrong happens while subscribing. Also, used as a background for the success notification.
--color-success: #07815C;
// Color border is used for borders separating each post card in the homepage, for example, and used as a color for the form input border.
--color-border: #ECECEC;
// Primary background is the website background. Also, used for the subscribe box icon color.
--background-primary: #FFFFFF;
// Secondary background used for the homepage content background, subscribe box, subscribe plans, author information block, and comments section.
--background-secondary: #F6F6F6;
// The hero background will inherit the secondary background from the above `--background-secondary`. I set a specific color variable to it if you want to put a unique color or make it the same as the website background.
--background-hero: var(--background-secondary);
}
Color Scheme Examples
Blew, you can find nine accessible color scheme examples.
Copy and past scheme code into the Ghost admin Code Injection Site Header.
All the color schemes are accessible colors for better reading and accessibility experience.
1. Dark
<style>
:root {
--color-brand: #DC514D;
--color-text-primary: #FFF;
--color-text-secondary: #9BAAC1;
--color-white: #FFFFFF;
--color-error: #FF6347;
--color-success: #00CF80;
--color-border: #292622;
--background-primary: #000;
--background-secondary: #241F21;
--background-hero: var(--background-secondary);
}
</style>
2. Monza
<style>
:root {
--color-brand: #D6001C;
--color-text-primary: #D6001C;
--color-text-secondary: #D6001C;
--color-white: #FFFFFF;
--color-error: #96281B;
--color-success: #134D13;
--color-border: #D6001C;
--background-primary: #FFFFFF;
--background-secondary: #FFF3CC;
--background-hero: var(--background-primary);
}
</style>
3. Soft Peach
<style>
:root {
--color-brand: #905656;
--color-text-primary: #241616;
--color-text-secondary: #412727;
--color-white: #FFFFFF;
--color-error: #96281B;
--color-success: #134D13;
--color-border: #e9dbdb;
--background-primary: #F6F0F0;
--background-secondary: #f2e9e9;
--background-hero: var(--background-primary);
}
</style>
4. Cinnamon
<style>
:root {
--color-brand: #805b00;
--color-text-primary: #000;
--color-text-secondary: #374c6d;
--color-white: #FFFFFF;
--color-error: #D91E18;
--color-success: #205E3B;
--color-border: #807D67;
--background-primary: #F4F6EF;
--background-secondary: #e4e6e0;
--background-hero: var(--background-secondary);
}
</style>
5. Bright Gray
<style>
:root {
--color-brand: #373f48;
--color-text-primary: #3C434C;
--color-text-secondary: #647180;
--color-white: #FFFFFF;
--color-error: #B22222;
--color-success: #20603C;
--color-border: #DFE3E9;
--background-primary: #FFFFFF;
--background-secondary: #E7EBF0;
--background-hero: var(--background-secondary);
}
</style>
6. Iron
<style>
:root {
--color-brand: #000;
--color-text-primary: #212121;
--color-text-secondary: #404040;
--color-white: #FFFFFF;
--color-error: #B50000;
--color-success: #20603C;
--color-border: #bdbec2;
--background-primary: #d6d7d9;
--background-secondary: #f2f2f3;
--background-hero: var(--background-secondary);
}
</style>
7. Linen
<style>
:root {
--color-brand: #b95d0e;
--color-text-primary: #000;
--color-text-secondary: #374c6d;
--color-white: #FFFFFF;
--color-error: #923026;
--color-success: #205E3B;
--color-border: #ece3dc;
--background-primary: #FFFFFF;
--background-secondary: #FCF3ED;
--background-hero: var(--background-secondary);
}
</style>
8. Turbo
<style>
:root {
--color-brand: #000000;
--color-text-primary: #000000;
--color-text-secondary: #000000;
--color-white: #FFFFFF;
--color-error: #5C0819;
--color-success: #005031;
--color-border: #000000;
--background-primary: #FEE900;
--background-secondary: #fff14a;
--background-hero: var(--background-primary);
}
</style>
9. Pampas
<style>
:root {
--color-brand: #c31118;
--color-text-primary: #292a2c;
--color-text-secondary: #65605E;
--color-white: #FFFFFF;
--color-error: #5C0819;
--color-success: #005031;
--color-border: #b2b2b2;
--background-primary: #F6F4F2;
--background-secondary: #eeedeb;
--background-hero: var(--background-primary);
}
</style>
If you have any schemes you would like to share, please let me know :)
Color Scheme Tools
The following are some online websites and tools to help with color inspiration. Please make sure you choose an accessible color scheme; this is important for readers.
- https://coolors.co/
- https://mdigi.tools/color-shades
- http://web-accessibility.carnegiemuseums.org/design/color/
- http://colorsafe.co/
- https://clrs.cc/a11y/
- https://accessible-colors.com/
Change Color of Specific Elements
If, for example, you want to add a color that’s not in the available theme variables or add another style to a new element, you can create a new variable and give it a name and value.
We can extend the previous example to add a new color for the logo color and assign that variable to the logo HTML element class .c-logo__link
.
<style>
:root {
--color-logo: blue;
}
.c-logo__link {
color: var(--color-logo);
}
</style>
The logo will then have a blue
color.
Members / Subscriptions
Make sure to Upload the routes.yaml file.
Enable subscribers by checking the Enable members checkbox on the Labs page in your Ghost admin panel.
Once enabled, different parts of the theme will appear on the website:
- Log in and Membership links in the Header
- Homepage subscription boxes
- A post subscription box
- Call to action section on the post page to encourage visitors to subscribe if the post is for members only
All the forms will be hidden automatically if the user is logged in.
Remove ‘Log in’ and ‘Membership’ links from Header
To remove Log in and ‘Membership’ links from the Header, open the partials/header.hbs
file and remove lines 18
to 26
. This will also remove the Account and Log out links.
Remove ‘Public’, ‘Members’ and ‘Paid’ Labels from Post Card
Open the partials/post-card.hbs
file and remove lines 5
to 11
.
Or, copy and paste the following CSS code into the Ghost admin Code Injection Site Header.
<style>
.c-post-card__visibility { display: none; }
</style>
Remove Subscribe Form from the Post Page
To remove the subscribe box on the post page. Open the post.hbs
file and remove lines from 32
to 44
.
Edit Plan Features
To edit the membership plan features, edit the partials/membership-plans.hbs
file.
Add Free Plan Column to Membership Page
To add a free column plan to the Membership page, you can create another column in the theme partials/theme-membership-plans.hbs
file by copying one of the current columns code.
Fill in your information like a list of benefits and so on.
For the button, add a link to the [/signup/] page so the button like will be like:
<a class='c-btn c-btn--outline' href='/signup/'>Free</a>
Your partials/theme-membership-plans.hbs
theme file might end up like this.
<div class='c-membership-plans'>
<div class='c-membership-plan'>
<header class='c-membership-plan__header'>
<h2 class='c-membership-plan__title'>{{t 'Free'}}</h2>
<span class='c-membership-plan__sign u-type-uppercase'></span>
<span class='c-membership-plan__amount'></span>
</header>
<div class='c-membership-plan__content'>
<ul class='c-membership-plan__list'>
<li>Full access to all private posts</li>
<li>Regular updates with new content</li>
</ul>
<a class='c-btn c-btn--outline' href='/signup/'>{{t 'Subscribe'}}</a>
</div>
</div>
<div class='c-membership-plan'>
<header class='c-membership-plan__header'>
<h2 class='c-membership-plan__title'>{{t 'Monthly'}}</h2>
<span class='c-membership-plan__sign u-type-uppercase'>{{ @price.currency_symbol }}</span>
<span class='c-membership-plan__amount'>{{ @price.monthly }}</span>
</header>
<div class='c-membership-plan__content'>
<ul class='c-membership-plan__list'>
<li>Full access to all private posts</li>
<li>Regular updates with new content</li>
<li>Support independent publishing</li>
</ul>
<a class='c-btn c-btn--outline' href='javascript:void(0)' data-members-plan='Monthly'>{{t 'Subscribe'}}</a>
</div>
</div>
<div class='c-membership-plan'>
<header class='c-membership-plan__header'>
<h2 class='c-membership-plan__title'>{{t 'Yearly'}}</h2>
<span class='c-membership-plan__sign u-type-uppercase'>{{ @price.currency_symbol }}</span>
<span class='c-membership-plan__amount'>{{ @price.yearly }}</span>
</header>
<div class='c-membership-plan__content'>
<ul class='c-membership-plan__list'>
<li>Full access to all private posts</li>
<li>Regular updates with new content</li>
<li>Support independent publishing</li>
<li>One easy payment instead of 12!</li>
</ul>
<a class='c-btn c-btn--outline' href='javascript:void(0)' data-members-plan='Yearly'>{{t 'Subscribe'}}</a>
</div>
</div>
</div>
You may want to reduce the column’s padding style so the content will have a breath after adding a third column.
Copy the following CSS code into the Ghost admin Code Injection Site Header.
<style>
.c-membership-plan { padding: 32px; }
</style>
The result will be like.
Add Custom Excerpt for Members Content with Gradient Style
Step One
Open the post.hbs
theme file and insert the following code before the {{> membership-upgrade }}
line 39
.
<div class='c-membership-excerpt'>
<p>Yes, Yes, without the oops! Just my luck, no ice. You know what? It is beets. I've crashed into a beet truck. You know what? It is beets. I've crashed into a beet truck.</p>
<br>
<p>I've crashed into a beet truck. You know what? It is beets. I've crashed into a beet truck. Forget the fat lady! You're obsessed with the fat lady! Drive us out of here! They're using our own satellites against us.</p>
</div>
Make sure to change the text inside the HTML p
elements above to add your text. You can add two paragraphs, one or more.
Step Two
Insert the following CSS code into the Ghost admin Code Injection Site Header.
<style>
.c-membership-excerpt {
position: relative;
}
.c-membership-excerpt:after {
content: '';
position: absolute;
right: 0;
bottom: 0;
left: 0;
height: 70%;
background: linear-gradient( to top, var(--background-primary) 0%, var(--background-primary) 30%, rgba(255, 255, 255, 0) 100% );
}
</style>
The result will be something similar to the following.
Membership Troubleshooting Tips
If for any reason the subscribe form does not work, or there is an error message, the following tips might help:
If you are self-hosting your website, make sure to set up the mail config. After doing that, restart your Ghost server.
The website config URL should match the URL used to access the website, as described in the Ghost docs.
Enter the URL that is used to access your publication. If using a subpath, enter the full path, https://example.com/blog/
. If using SSL, always enter the URL with https://
..
For more information about Members, connecting Stripe, and setting the package price, check the official Ghost documentation.
Navigation
You can add, edit, delete, and reorder menu links on your Ghost blog in the NAVIGATION section (Admin > Settings > Design).
To include a static page on your navigation menu, follow these steps.
First, type the page’s name as you’d like it appear on your menu in the label field.
Next, click on the item’s URL. The blog URL will already be auto-populated. Add the page slug after the final /. When you’re satisfied with your page configurations, click the blue Save button to add the page to the navigation menu.
Social Media Icons
The theme file for the navigation social media icon links is partials/social-icons.hbs
.
Ghost supports adding Facebook and Twitter profile URLs from the admin panel. Go to General > Social accounts and add your URLs, and the theme will automatically add them in the site navigation.
The theme uses Evil Icons to provide simple and clean icons for other social accounts. Here you can find a list of the social media icons to use:
<span data-icon='ei-sc-facebook' data-size='s'></span>
GitHub
<span data-icon='ei-sc-github' data-size='s'></span>
<span data-icon='ei-sc-instagram' data-size='s'></span>
<span data-icon='ei-sc-linkedin' data-size='s'></span>
Odnoklassniki
<span data-icon='ei-sc-odnoklassniki' data-size='s'></span>
<span data-icon='ei-sc-pinterest' data-size='s'></span>
Skype
<span data-icon='ei-sc-skype' data-size='s'></span>
SoundCloud
<span data-icon='ei-sc-soundcloud' data-size='s'></span>
Telegram
<span data-icon='ei-sc-telegram' data-size='s'></span>
Tumblr
<span data-icon='ei-sc-tumblr' data-size='s'></span>
<span data-icon='ei-sc-twitter' data-size='s'></span>
Vimeo
<span data-icon='ei-sc-vimeo' data-size='s'></span>
VK
<span data-icon='ei-sc-vk' data-size='s'></span>
Youtube
<span data-icon='ei-sc-youtube' data-size='s'></span>
As mentioned above, Ghosts supports adding only Twitter and Facebook links from the admin. But the theme comes with an additional Instagram icon as an example.
Edit or update these in the partials/social-icons.hbs
file. For example, here’s the Instagram code block:
<li class='c-nav__item c-nav__item--social'>
<a href='#' title='Instagram' target='_blank' rel='noopener'>
<span class='c-nav__item__icon' data-icon='ei-sc-instagram' data-size='s'></span>
<span class='u-hidden-visually'>Instagram</span>
</a>
</li>
The code above contains the icon code from the above list and the social media link (a
) within a list element (li
).
Next, replace your Instagram full URL with the link href
value. If your Instagram URL is:
https://www.instagram.com/ghost/
Then the new code will be:
<li class='c-nav__item c-nav__item--social'>
<a href='https://www.instagram.com/ghost/' title='Instagram' target='_blank' rel='noopener'>
<span class='c-nav__item__icon' data-icon='ei-sc-instagram' data-size='s'></span>
<span class='u-hidden-visually'>Instagram</span>
</a>
</li>
If you want to remove Instagram altogether, you can delete all the code block, the li
, a
, and the icon.
Secondary Footer Navigation
Similar to Header Navigation, you can add the footer navigation from the SECONDARY NAVIGATION section (Admin > Settings > Design).
Pages
Manage pages for Archive, Blog, and Contact.
Archive Page
Make sure to Upload the routes.yaml file.
The Archive page shows all posts organized by month and also contains all website tags.
The archive page theme file is archive.hbs
.
To add the archive item to the site navigation, add it as a navigation item. Make sure to set the destination URL to /archive/
like the following screenshot.
Blog Page
Make sure to Upload the routes.yaml file.
The blog page includes your recent ten posts with a load more bottom to load more.
You can change the number of posts from the Posts Per Page setting.
The blog page theme file is index.hbs
.
To add the blog item to the site navigation, add it as a navigation item. Make sure to set the destination URL to /blog/
like the following screenshot.
Contact Page
To create the Contact page:
- Create a new Page and give it a title, like “Contact”.
- Add your content and the contact form code using FORMSPREE as a service. Please check the code example below.
- Publish the page.
- To add the page to the navigation, please check the Navigation section above.
<form action="https://formspree.io/your@email.com" method="POST">
<input type="text" name="name" placeholder="Name"><br>
<input type="email" name="_replyto" placeholder="Email"><br>
<textarea name='message' placeholder="Message"></textarea><br>
<input class='c-btn c-btn--action' type="submit" value="Send">
</form>
For more information, check out How to Add a Contact Form to Your Ghost Blog.
Languages
Ubud comes in many languages already. But if you’d like to add another one, you’ll be able to do that too.
Theme Translation
Ubud supports Ghost i18n and comes with Arabic, German, Italian, Spanish, French, Finnish, Portuguese Dutch, Turkish, and Danish translations.
To use a language other than English, go to Admin > General > PUBLICATION INFO > Publication Language and enter the ISO Code.
ar
for Arabicda
for Danishde
for Germanyen
for Englishes
for Spanishfi
for Finnishfr
for Frenchit
for Italiannl
for Dutchpt
for Portuguesetr
for Turkish
Add a New Language
To add a new language, follow these steps.
- Create a new file in the theme’s
locales
folder with the language ISO Code code. So, if the new language is Arabic, the new file name will bear.json
. - Copy the
en.json
file content into your new file and start to translate, as shown in the following section. - Go to Admin > General > PUBLICATION INFO > Publication Language and enter the language code (
ar
in this example).
Edit a Translation
To improve or edit a translation in a specific available language, you can open the language file in the locales
folder:
|____locales
| |____ar.json
| |____da.json
| |____de.json
| |____en.json
| |____es.json
| |____fi.json
| |____fr.json
| |____it.json
| |____nl.json
| |____pt.json
| |____tr.json
For example, the German translation file looks like this:
{
"Skip to content": "Zum Inhalt springen",
"Loading": "Wird geladen",
"More Posts ↓": "Weitere Artikel ↓",
"All Posts →": "Alle Artikel →",
"Recent Posts": "kürzliche Artikel",
"Featured Posts": "Beliebte Beiträge",
"Page Not Found": "Seite nicht gefunden",
"Published with {ghostLink} & {themeLink}": "Veröffentlicht mit {ghostLink} & {themeLink}",
"Share on Twitter": "Auf Twitter teilen",
"Share on Facebook": "Auf Facebook teilen",
"Share on LinkedIn": "Auf LinkedIn teilen",
"Share on Pinterest": "Auf Pinterest teilen",
"Share via Email": "Per E-Mail teilen",
"Copy link": "Link kopieren",
"Link copied to clipboard": "Link in die Zwischenablage kopiert",
"Archive": "Archiv",
"Tags": "Stichworte",
"1 min read": "1 minuten gelesen",
"% min read": "% minuten gelesen",
"Paid": "Bezahlt",
"Members": "Mitglieder",
"Public": "Öffentlichkeit",
"Account": "Konto",
"Log in": "Einloggen",
"Log out": "Ausloggen",
"Continue": "Fortsetzen",
"Subscribe": "Abonnieren",
"Membership": "Mitgliedschaft",
"Your email address": "Deine E-Mail-Adresse",
"{siteTitle} Newsletter": "{siteTitle} Newsletter",
"Please check your inbox and click the link to complete the login.": "Bitte überprüfen Sie Ihren Posteingang und klicken Sie auf den Link, um die Anmeldung abzuschließen.",
"Please check your inbox and click the link to confirm your subscription.": "Bitte überprüfen Sie Ihren Posteingang und klicken Sie auf den Link, um Ihr Abonnement zu bestätigen.",
"Please enter a valid email address!": "Bitte geben Sie eine gültige E-Mail-Adresse ein!",
"An error occurred, please try again later.": "Ein Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.",
"You've successfully subscribed to {siteTitle}": "Sie haben {siteTitle} erfolgreich abonniert.",
"Great! Next, complete checkout for full access to {siteTitle}": "Toll! Schließen Sie als Nächstes die Prüfung ab, um vollen Zugriff auf {siteTitle} zu erhalten.",
"Welcome back! You've successfully signed in.": "Willkommen zurück! Sie haben sich erfolgreich angemeldet.",
"Success! Your account is fully activated, you now have access to all content.": "Erfolg! Ihr Konto ist vollständig aktiviert, Sie haben nun Zugriff auf alle Inhalte.",
"Success! Your billing info is updated.": "Erfolg! Ihre Zahlungsinformationen werden aktualisiert.",
"Billing info update failed.": "Aktualisierung der Rechnungsinformationen fehlgeschlagen.",
"Already have an account?": "Hast du schon ein Konto?",
"Don't have an account yet?": "Sie haben noch keinen Account?",
"This Content Is for Members": "Dieser Inhalt ist für Mitglieder",
"This Content Is for Paid Members": "Dieser Inhalt ist für bezahlte Mitglieder",
"Join the newsletter to receive the latest updates in your inbox.": "Treten Sie dem Newsletter bei, um die neuesten Updates in Ihrem Posteingang zu erhalten",
"Premium Membership": "Premium Mitgliedschaft",
"Unlock full access to {siteTitle} and see the entire library of members-only content.": "Schalten Sie den vollständigen Zugriff auf {siteTitle} frei und zeigen Sie die gesamte Bibliothek mit Inhalten nur für Mitglieder an.",
"Subscribe to {siteTitle}": "Anmelden bei {siteTitle}",
"Monthly": "Monatlich",
"Yearly": "Jährlich",
"Log in to {siteTitle}": "Melden Sie sich bei {siteTitle} an",
"Send login link": "Anmeldelink senden",
"Your subscription will expire on": "Ihr Abonnement läuft am ab",
"Your plan": "Dein Plan",
"Card": "Karte",
"Expires": "Läuft ab",
"Next bill date": "Nächstes Rechnungsdatum",
"Edit billing info": "ERechnungsinformationen bearbeiten",
"You have an active {siteTitle} account with access to all posts.": "Sie haben ein aktives {siteTitle} Konto mit Zugriff auf alle Posts.",
"You are subscribed to free updates from {siteTitle}, but don't have a paid subscription to read all the posts.": "Sie haben kostenlose Updates von {siteTitle} abonniert, haben jedoch kein kostenpflichtiges Abonnement, um alle Beiträge zu lesen."
}
Each line consists of a left key ("Loading"
) and a right value ("Wird geladen"
).
The key is plain English that exists in all translation files and should not be changed. You should change only the value.
If you have any suggestions to improve a current translation or add a new language, please contact me.
RTL
RTL means a right to left. Turning on RTL makes the theme readable for languages written from right to left, like Arabic or Hebrew.
To enable the RTL option, open the partials/head.hbs
file and change line 9
to {{> compiled/inline-css-rtl }}
.
Once you finish, zip the theme files, and upload the final zip file to your Ghost website.
Comments
The theme supports comments from Disqus, Commento, and CommentBox.
If you display comments for logged in users only, they will need to login/register into the comment system again. As you know, Ghost has no comment system, and these are third-party tools that are not integrated with and not part of Ghost.
For questions or issues about the commenting systems here, please contact their authors or check out their documentation.
Disqus
To enable Disqus as a comments system, open the partials/disqus.hbs
file. Replace the aspirethemes-demos
value with the disqus_shortname
variable to match your Disqus account shortname.
var disqus_shortname = 'aspirethemes-demos';
So, if your Disqus shortname is exampleone
, the final code above should be:
var disqus_shortname = 'exampleone';
From the theme side, that’s all you need to set up Disqus. If you have any issues with comments not loading, make sure you have registered your website with Disqus (Step 1).
If you still have issues, check the Disqus troubleshooting guide.
Disable Disqus
To disable Disqus comments, open the post.hbs
file and comment or delete the line containing the {{> disqus}}
text (line 33
).
Disable Disqus Recommendations
Checkout the Disqus Recommendations documentation.
If you have any issue with Disqus redirecting to any advertising pages, please disabled Tracking and Affiliate Links from your Disqus account.
Check out Keegan Leary’s blog post about this issue at https://keeganleary.com/disqus-is-evil-trash/.
Also, be aware of Disqus trackings. Check out https://supunkavinda.blog/disqus.
So, you might want to use another commenting system.
Thanks for sharing, Keegan!
CommentBox
To enable CommentBox as a comments system, open post.hbs
file and replace line 33
replace with {{> commentbox}}
.
The next step is to create a CommentBox account. From the dashboard, create a new project by filling your site information. You will then receive a Project ID.
Copy that Project ID, open the partials/commentbox.hbs
file, and replace the my-project-id
value with it. That’s it.
Commento
To enable Commento as a comments system, open the post.hbs
file and replace line 33
with {{> commento}}
.
The next step is to create a Commento account and register your domain with it.
Posts Per Page
You can control how many posts display per page from the package.json
file.
"config": {
"posts_per_page": 10
}
The theme default value is set to 10
posts per page.
Note
This will not apply to the homepage but for the Blog page, Author, and Tag pages. For the homepage, checkout Homepage Number of Posts.
Google Analytics
To integrate Google Analytics, I recommend using the Google Analytics integration by Ghost.
Update Favicon
You can change the favicon in Ghost from Admin > General > PUBLICATION IDENTITY > Publication icon.
Responsive Tables
Responsive tables are required and essential for adding tabular content and allowing tables to be scrolled horizontally. You can make any table responsive across all viewports by wrapping a table
with .responsive-table
, for example:
<div class='responsive-table'>
<table>
...
</table>
</div>
Social Sharing Icons
You can customize and update a post’s social media sharing icons from the partials/share.hbs
theme file.
Syntax Highlighting
You can add a fenced code block by placing triple backticks ```
before and after the code block. For example:
``` pre { background-color: #f4f4f4; max-width: 100%; overflow: auto; } ```
This will produce the following gray look:
To highlight a code block, add the language alias like css
or js
to the code block. For example, the CSS code in the previous example will wrap between ```css
and ```
as follows:
```css pre { background-color: #f4f4f4; max-width: 100%; overflow: auto; } ```
This will produce the following colored look:
To add inline code, wrap the text between two backticks ` `
.
Prism
Ubud ships with Prism.js, a lightweight, robust, and elegant syntax highlighter.
The initial Prism package includes some languages, like Markup, CSS, C-like, and JavaScript.
You can add support for more languages. For example, to add support for PHP, get the PHP component script from Prism CDN.
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.13.0/components/prism-php.js"></script>
From the side admin menu, go to Code Injection and add the script to the Site Footer section. Be sure to click Save.
Theme Deploy with GitHub Actions
Ubud comes integrated with the Deploy Ghost Theme ↗ Github action.
I have written about this at How to Deploy Your Ghost Theme Using Github Actions ↗. All you need to do is follow steps 1 and 2.
Code Injection
Another choice for customization is to use the Ghost Code Injection settings in Ghost admin.
For a CSS example, you can use the following code in the Site Header section to change the logo color and font size.
<style>
.c-logo__link {
color: #4550E5;
font-size: 32px;
}
</style>
Watch the following short video about Ghost Code Injection, how it works, and how to use it.
Customize Logo Size
If you are using an image as a logo (instead of the site name) and want to change the logo size, use the following code in Code Injection.
<style>
.c-logo__img {
max-height: 40px;
}
</style>
The default value is 40px
, so you can increase this value to match your preference.
If the logo image has a large white space around it, trim that space with a photo editing app for better results.
Remove Dates
To remove the dates from the theme homepage and listing pages, add the following CSS code into Ghost admin Code Injection Site Header.
<style>
.c-post-card__meta { display: none; }
.c-post-card {
grid-template-areas: 'content content content content content content content content content media media media';
}
.c-post-card--no-image {
grid-template-areas: 'content content content content content content content content content content content content';
}
</style>
To only remove the date and keep the Public
, Members
and Paid
labeles, use the following.
<style>
.c-post-card__date {
display: none;
}
</style>
To remove date from the post page, use the following.
<style>
.c-post-header__date {
display: none;
}
</style>
Changing Theme Font
Ubud is using one font, Inter.
The theme loads Inter using Google Fonts in the theme partials/fonts.hbs
file. It is then assigned as a CSS Variable and other system fonts as a backup as the following example.
:root {
--type-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
}
To change to any other font, you need to include the font on your theme or using Code Injection Site Header if you are using Google Fonts, for example.
For example, if you want to use the Roboto font from Google Fonts. Your code in Code Injection might be like this.
<link href='https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap' rel='stylesheet'>
<style>
:root {
--type-sans-serif: 'Roboto', sans-serif;
}
</style>
Theme Development
If you are a developer and need to do heavy customization work, the theme uses Gulp to compile Sass and JavaScript. This improves the development flow and makes it much faster.
Note
Changing any hbs
file, for example, the post.hbs
file does not require being in development mode with gulp running. Just edit the file in your preferred editor and upload it.
First, make sure you have Node.js, npm, Gulp CLI, and Bower installed. Check My Current Setup.
Run the following command in the theme root directory to install npm and bower dependencies.
npm install
To start Gulp, run:
gulp
This will compile Sass and JavaScript files and start watching changes as you edit files.
Gulp will produce two files:
assets/js/app.min.js
: The final main JavaScript filepartials/compiled/inline-css.hbs
: The final CSS file
If you are working with Gulp, it’s recommended you avoid editing these files. Instead, do customizations in assets/sass
for CSS or in assets/js/app.js
JavaScript. This way, you can make sure the flow is going in the right direction and never lose any changes.
My Current Setup
In case you are wondering what my current environment set up is and which package versions I use, take a look at the following:
$ node -v
v10.16.0
$ npm -v
6.14.8
$ bower -v
1.8.8
$ gulp -v
CLI version: 2.2.0
Local version: 4.0.2
This environment works well for running Ghost and also for theme development.
I use macOS Big Sur.
Zip Theme Files
To create a zip file after your theme changes, you can use one of the following options.
Use one of the first two options if you are on a Theme Development mode.
1. Using the command line
zip -r ubud.zip ubud -x '*node_modules*' '*bower_components*'
This will exclude the node_modules and bower_components directories from the final zip file.
2. Using Gulp
If you are running gulp, you can type the gulp zip
command to do this.
3. Using your computer program
You can compress it as a standard folder just like you do with any other folder on your computer. If you are on Mac, right-click on it to view the context menu. Then, click the “Compress” option.
Theme Update
You may be wondering: how can I update my theme to the latest theme version?
There are two choices:
- Keep your current theme and replace only the changed files from the new version. You can find the modified files on the theme page Changelog
- Use the latest version as a starting point and redo your theme changes and customizations
One way to reduce the need for redoing customizations is to use the Code Injection tool. This is very helpful for adding custom CSS and tracking code. Keeping your custom CSS code with Code Injection is always recommended.
Tell me your feedback and your experience
I'm open to your feedback and to hear about your experience. If you have about one minute, please send your thoughts through this Google Form ↗.
Thank you for your time!