PhoneGap Blog
This is a fairly vanilla Jekyll/GitHub Pages site. It has been optimized for improved page loading speed; see this article for a full description.
Setup
Install rvm
to manage Ruby versions:
$ \curl -sSL https://get.rvm.io | bash -s stable
Install Ruby:
$ rvm install 2.1.5
$ rvm use 2.1.5 --default
$ ruby -v
ruby 2.1.5
Install the Ruby Bundler:
$ gem install bundler
Clone this repository:
$ git clone https://github.com/phonegap/blog.git
$ cd blog/
Install the Ruby dependencies for phonegap.com:
$ bundle install
Running Locally
Build and watch everything except the blog:
$ rake watch
Then open a browser to http://localhost:4000/blog/
.
Build and watch everything including the blog:
$ jekyll serve --incremental
Then open a browser to http://localhost:4000/blog/
.
Writing Blog Posts
- To write a post, commit a markdown file to the
_posts/blog/
directory. - You can use the post template as a starting point.
- Optionally you can also use a Rake task to create the new post file locally. Install Ruby and Rake as mentioned above in the "Setup" section. Run
$ rake post["Put the Post Title Here"]
- Optionally you can also use a Rake task to create the new post file locally. Install Ruby and Rake as mentioned above in the "Setup" section. Run
- Name the file with the date first, followed by a url friendly version of the title. Example:
2016-02-24-phonegap-desktop-app-0.2.2.md
- Tag pages have to be set up manually; do your best to use existing ones, if you need to set up a new one, setup a new tag page in the
/blog/tags
using the tag template - Use markdown for simple formatting. It is converted to html using Kramdown
- Avoid using inline html.
- For videos use
{% include video.html id="<youtube or vimeo id>" %}
. You can also change thetype
tovimeo
oradobetv
; defaults toyoutube
. - To include images, add them to
/uploads/[4 digit year]-[2 digit month]
. If the directory you need for the month isn't there, feel free to add it. To include the image in the post just use the same directory structure:![Browser](/blog/uploads/2016-02/Browser.jpg)
. - Kramdown is using GitHub Flavored Markdown. The easiest way to add code snippets is to using triple backticks; you can also define the language for better syntax highlighting. For a full list of languages here.
- You can preview the post locally using the setup and commands mentioned above in the Setup section.
- If you have write access to this repo and you feel comfortable with the blog post, feel free to commit to master.
- If you don't have write access to this repo, or you would like a review, please make a pull-request.
Test Locally
HTML Proofer
The site is using Travis CI and HTML Proofer to check the html and referenced urls. Before you make a pull request it's a good idea to run the tests locally first.
Just run the command:
$ rake test
The output should be something like:
Running ["ScriptCheck", "LinkCheck", "ImageCheck"] checks on ./_site on *.html...
Checking 7 external links...
Ran on 3 files!
HTML-Proofer finished successfully.
Markdown Lint
The markdown files are also checked with markdownlint
. To run it locally use:
npm install
Then
npm run lint
If with tests find any errors be sure to fix them before making the pull-request.