Skip to content

Latest commit

 

History

History
111 lines (74 loc) · 6.06 KB

File metadata and controls

111 lines (74 loc) · 6.06 KB

Ghost Cheatsheet

Installation: https://ghost.org/docs/install/local/ Ghost Forum: https://forum.ghost.org/

Workflow for new Project

  • empty folder
  • cd into it and: ghost install local
  • cd into themes and: git init ("It is usually suggested to have just the theme (not the installation) as your git repository." (Ghost Forum))
  • connect and upload to github
  • download desired theme
  • copy theme, rename it and start working with it

ghost stop to stop Ghost ghost start to start Ghost ghost log views logs ghost ls to list all running Ghost blogs ghost help for a list of available commands, or explore the full Ghost-CLI documentation. ghost version to list versions of Ghost and Ghost-CLI

Installation of Handlebars is already done for you in Ghost.

structure of a ghost theme

Bare minimum of a Ghost theme:

A folder with index.hbs, post.hbs and package.json. This will bring up loads of warnings if you activate it in your admin view but it will work. Tutorial: https://www.youtube.com/watch?v=NqHw0we2WP4&list=PLtKjv92L0ihBBXGz7iCdtTkvdD0dXXy78&index=7

Ghost helpers

This is where the magic lies! 🤓 😇 from the docs: https://ghost.org/docs/themes/helpers/

Core elements

Ghost (and subsequently Ghost themes) have a few core concepts from which they build their structure. Most of these are standard elements of any blogging engine or platform.

Posts: Referred to as “Stories” within user admin, posts are the base unit of Ghost. They’re blog posts… like the one you’re reading… right now. Pages: Pages are actually a sub-variant of posts. They have all the same properties as posts, but are excluded from the list/index of posts and won’t appear on the homepage. Authors: Authors are discrete objects that are associated posts and pages. The authors in a blog will also have their own pages including their avatar, description, and the post they’ve written. Navigation: Navigation is user customizable via the Ghost admin. You’re able to design a template within your theme for how the navigation manifests on each page. Tags: Tags can be associated with either posts or pages. Like authors, tags get their own page with all the posts that have the relevant tag, as well as an optional image and description. When tagging a post, the first tag in the series considered the “primary tag,” and can be given special features or privileges within the theme. Blog Attributes: The blog themselves can also have various attributes that are customized via the admin. This includes blog title, blog description, logos, and social icons. Email Signup: The enabling of email sign-up within the admin is currently optional and is by default deactivated. However, you can definitely add support for it within your theme. There’re two items associated with email subscription. First is a partial, that can be included anywhere throughout your site, which will generate a standard e-mail signup form. The second is a discrete email subscription page which is also customizable, comes pre-baked with a standard look and feel similar to that of the login page. You also have the ability to customize the login pages for Ghost, but doing so is typically unneeded for the majority of projects.

How to modify a theme

blog and his code

Current Folder

"Don’t worry about the current folder, that’s your installation of ghost; you don’t want to touch that." "...of course – naturally current should be (and is) a symlink to the currently active version’s folder."

Version Folder

"The version-level content folder is mainly used for developing Ghost, but also contains the latest release of casper."

Version Control and pair development

"First I would say separate the production instance… for developing theme setup a Development instance ghost install local

On dev instance use github only for the theme folder content/themes/casper

Deploy the theme to production with github action https://github.com/marketplace/actions/deploy-ghost-theme " https://forum.ghost.org/t/what-is-the-best-way-for-pair-ghost-theme-development/16797

Multilingual

From the docs: "A multi-language content site supports multiple languages at the same time, like publishing in Spanish and English.

If you plan on publishing different content in each language, we recommend one Ghost install per language. Our experience shows that this approach is not only the easiest to get off the ground, but it’s also the most sustainable long-term.

If you’re publishing the same content in different languages, then we recommend using a service like WeGlot or Transifex."

source: https://ghost.org/docs/faq/translation/#multi-language-content possibly useful article: https://www.benjaminrancourt.ca/how-to-support-multilingual-pages-in-ghost/

Update Ghost

The command ghost update will coach you through the update. "If you installed Ghost using Ghost-CLI, the ghost update command will inform you of the commands to run to perform the necessary intermediate updates."

Docs: https://ghost.org/docs/update/


Workflow for Ghost in Docker

  • start Docker
  • in project directory: docker-compose up -d
  • (if JS and CSS compiled with gulp:
    • cd into content/themes/example-theme and run gulp)
  • after finishing: docker-compose down
updating Ghost:
  • Docker runterfahren docker-compose down
  • docker system prune -af löscht global alle Images!
    • (--all, -a: Remove all unused images not just dangling ones)
    • (--force, -f: Do not prompt for confirmation)
  • Beim nächsten docker-compose up -d sollte er sich das aktuelle Image ziehen. Möglicherweise (2021-08-25) ein 2. Mal laufen lassen.

Docs: https://docs.docker.com/engine/reference/commandline/system_prune/

Ghost and Git

  • every login via admin (localhost:3001/ghost), resonates in the database - no problem; just so you know ; )