Engagement/Developer Engagement/Hacks blog/Writing: Difference between revisions

(update to an outdated page)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Writing for Mozilla Hacks=
=Writing for Mozilla Hacks=
This page contains useful information for people posting on the [http://hacks.mozilla.org Hacks blog].


==Writing in plain text, Markdown or HTML==
THIS PAGE IS NO LONGER CURRENT. PLEASE VISIT the [https://wiki.mozilla.org/Devrel/Hacks Hacks wiki] for must current useful information for people who would like to post on the [http://hacks.mozilla.org Hacks blog].


If you are writing a draft in whatever environment you prefer: write it in plain text, Markdown or HTML and send to the Editor of Mozilla Hacks (mozhacks [at] mozilla [dot] com).
==Writing in plain text or HTML==


If you write directly in Mozilla Hacks' Wordpress instance: The WYSIWYG editor in WordPress produces very bad HTML, which reflects poorly on our expertise if people view the source of posts. So, please don't use it. There's even a profile setting, "Disable the visual editor when writing". If this wasn't set by whoever created your account, please go in and change your own profile, so you don't accidentally use the visual editor.
If you are writing a draft in whatever environment you prefer: write it in plain text or HTML and send to the Editor of Mozilla Hacks (mozhacks [at] mozilla [dot] com). We can also accept drafts writtten in Markdown. Once the initial draft has been received and accepted for publication, we will create an author account for you on the Mozilla Hacks blog. You will be responsible for  adding and iterating from within Wordpress admin interface, with revision and reviewer support by the Hacks team.
 
NOTE: If you write directly in Mozilla Hacks' Wordpress instance, the WYSIWYG editor in WordPress produces very bad HTML, which reflects poorly on our expertise if people view the source of posts. So, please don't use it. There's even a profile setting, "Disable the visual editor when writing". If this wasn't set by whoever created your account, please go in and change your own profile, so you don't accidentally use the visual editor.
 
==Mozilla Hacks author account==
 
The Editor of Mozilla Hacks will set you up with an account. Make sure to have a bio ready and that your e-mail address is connected to a [https://en.gravatar.com/ Gravatar]. Additionally, please inform the Editor about potential website URLs, Twitter, Facebook and Google+ accounts you want to show with your profile.
 
==Embedding media and https==
 
The width of the content on Mozilla Hacks is 500 pixels. Make sure that images, embedded videos etc are adapted to that. If you want to add images to your post, please [https://hacks.mozilla.org/wp-admin/media-new.php upload them to Mozilla Hacks] and then reference their URL with an <img> element.
 
<b>Note:</b> Mozilla Hacks is being served as https so if you embed anything, it has to support https as well, due to [https://blog.mozilla.org/tanvi/2013/04/10/mixed-content-blocking-enabled-in-firefox-23/ Mixed Content Blocking]. For instance, at the time of writing (April 26th 2013), YouTube and GitHub embeds supports https, Vimeo and jsFiddle doesn't.
 
==Using code samples in your post==
 
When you write code samples in your post, make sure to wrap code blocks spanning over multiple lines with <tt>&lt;pre&gt;</tt> elements. As described above, we use the GeSHI support to generate color highlighting for your code.
To enable that, just use the <tt>lang</tt> attribute on the <tt>&lt;pre&gt;</tt> element, like this:
 
<pre>&lt;pre lang="javascript"&gt;
    var URL = "https://hacks.mozilla.org/";
&lt;/pre&gt;</pre>
 
For code formatting within text/paragraphs, wrap them with <tt>&lt;code&gt;</tt> elements:
 
<pre>This is some text about the <code>canvas</code> element</pre>
 
 
Note:
 
* Do <b>not</b> use &lt;code&gt; elements in code blocks wrapped with the <tt>&lt;pre&gt;</tt> element
* Do <b>not</b> escape HTML entities like <, > and & with &amp;lt;, &amp;gt; and &amp;amp; in those code blocks
 
Another option is also embedding gists or similar. Note: it has to support https (see above).


==Sharing code==
==Sharing code==
Line 14: Line 46:
The following plug-ins are installed on Hacks:
The following plug-ins are installed on Hacks:
* [http://akismet.com/ Akismet]: spam filter
* [http://akismet.com/ Akismet]: spam filter
* [http://www.artiss.co.uk/code-embed Artiss Code Embed]: allows embedding privileged code in posts
* [http://wordpress.org/extend/plugins/co-authors-plus/ Co-Authors Plus]: allows multiple authors to be assigned to a post
* [http://wordpress.org/extend/plugins/co-authors-plus/ Co-Authors Plus]: allows multiple authors to be assigned to a post
* FC Pagination: Show numbered pagination instead of "Next page" and "Previous Page" (by Craig Cook)
* FC Pagination: Show numbered pagination instead of "Next page" and "Previous Page" (by Craig Cook)
Line 23: Line 54:
* [http://crowdfavorite.com/wordpress/plugins/twitter-tools/ Twitter Tools]: supports auto-tweeting articles
* [http://crowdfavorite.com/wordpress/plugins/twitter-tools/ Twitter Tools]: supports auto-tweeting articles
* [https://github.com/blaenk/wp-recaptcha WP-reCAPTCHA]: integrates reCAPTCHA with WordPress
* [https://github.com/blaenk/wp-recaptcha WP-reCAPTCHA]: integrates reCAPTCHA with WordPress
* [http://wordpress.org/extend/plugins/wp-syntax/ WP-Syntax]: Syntax highlighting with GeSHi: use &lt;pre lang="LANGUAGE_NAME" line="1"&gt; to highlight for LANGUAGE_NAME, with line numbers
* [http://wordpress.org/extend/plugins/wp-syntax/ WP-Syntax]: Syntax highlighting with [http://qbnz.com/highlighter/ GeSHi]: use &lt;pre lang="LANGUAGE_NAME" line="1"&gt; to highlight for LANGUAGE_NAME, with line numbers
 
==Using privileged elements==
By default in WordPress, only users with Administrator privileges can post &lt;audio&gt;, &lt;video&gt;, or &lt;iframe&gt; elements. If non-admin users try to publish posts containing these elements, the elements are stripped out. On Hacks, we now use the [http://wordpress.org/extend/plugins/simple-embed-code/other_notes/ Artiss Code Embed] plug-in to enable non-admin users to publish privileged elements.
 
To use this plug-in:
 
# While in the '''Edit Post''' view, click '''Screen Options''', under the WordPress toolbar. The screen options panel expands.
# Select the '''Custom Fields''' checkbox. You only need to do this once. After you have used custom fields, they will be displayed for you by default.
# In the '''Custom Fields''' section of the page, under "Add New Custom Field", click '''Enter new'''.
# Under '''Name''', type "CODE" and any identifier of your choice, so that "CODE" is the prefix of your identifier. For example "CODEfoobar".
# Under '''Value''', type the code for privileged element, including any attributes, exactly as you would type it in an HTML page.
# Click '''Add Custom Field'''.
# In the body of your post, wherever you want the privileged element to appear, type the identifier you defined as a custom field, surrounded by "%" characters. For example "%CODEfoobar%".
# Preview or publish the post as you normally would. The value of the custom field is substituted into your post.
 
You can reuse a custom field that was defined on another post. Use the '''Code Embed > Search''' item in the side navigation to find existing fields for Code Embed.

Latest revision as of 00:59, 6 April 2015

Writing for Mozilla Hacks

THIS PAGE IS NO LONGER CURRENT. PLEASE VISIT the Hacks wiki for must current useful information for people who would like to post on the Hacks blog.

Writing in plain text or HTML

If you are writing a draft in whatever environment you prefer: write it in plain text or HTML and send to the Editor of Mozilla Hacks (mozhacks [at] mozilla [dot] com). We can also accept drafts writtten in Markdown. Once the initial draft has been received and accepted for publication, we will create an author account for you on the Mozilla Hacks blog. You will be responsible for adding and iterating from within Wordpress admin interface, with revision and reviewer support by the Hacks team.

NOTE: If you write directly in Mozilla Hacks' Wordpress instance, the WYSIWYG editor in WordPress produces very bad HTML, which reflects poorly on our expertise if people view the source of posts. So, please don't use it. There's even a profile setting, "Disable the visual editor when writing". If this wasn't set by whoever created your account, please go in and change your own profile, so you don't accidentally use the visual editor.

Mozilla Hacks author account

The Editor of Mozilla Hacks will set you up with an account. Make sure to have a bio ready and that your e-mail address is connected to a Gravatar. Additionally, please inform the Editor about potential website URLs, Twitter, Facebook and Google+ accounts you want to show with your profile.

Embedding media and https

The width of the content on Mozilla Hacks is 500 pixels. Make sure that images, embedded videos etc are adapted to that. If you want to add images to your post, please upload them to Mozilla Hacks and then reference their URL with an <img> element.

Note: Mozilla Hacks is being served as https so if you embed anything, it has to support https as well, due to Mixed Content Blocking. For instance, at the time of writing (April 26th 2013), YouTube and GitHub embeds supports https, Vimeo and jsFiddle doesn't.

Using code samples in your post

When you write code samples in your post, make sure to wrap code blocks spanning over multiple lines with <pre> elements. As described above, we use the GeSHI support to generate color highlighting for your code. To enable that, just use the lang attribute on the <pre> element, like this:

<pre lang="javascript">
    var URL = "https://hacks.mozilla.org/";
</pre>

For code formatting within text/paragraphs, wrap them with <code> elements:

This is some text about the <code>canvas</code> element


Note:

  • Do not use <code> elements in code blocks wrapped with the <pre> element
  • Do not escape HTML entities like <, > and & with &lt;, &gt; and &amp; in those code blocks

Another option is also embedding gists or similar. Note: it has to support https (see above).

Sharing code

When you write a blog post that contains code, please consider adding that code to the Mozilla Hacks repository on GitHub. That way, people can read, fork and easily work on that code themselves!

Installed Plug-ins

The following plug-ins are installed on Hacks:

  • Akismet: spam filter
  • Co-Authors Plus: allows multiple authors to be assigned to a post
  • FC Pagination: Show numbered pagination instead of "Next page" and "Previous Page" (by Craig Cook)
  • FD Footnotes: supports footnotes
  • SEO Smart Links: helps SEO through auto-generation of links
  • Subscribe to comments: lets users subscribe to comments
  • Time Release: queues posts to publish after inactivity
  • Twitter Tools: supports auto-tweeting articles
  • WP-reCAPTCHA: integrates reCAPTCHA with WordPress
  • WP-Syntax: Syntax highlighting with GeSHi: use <pre lang="LANGUAGE_NAME" line="1"> to highlight for LANGUAGE_NAME, with line numbers