Engagement/Developer Engagement/Hacks blog/Writing
Writing for Mozilla Hacks
This page contains useful information for people posting on the Hacks blog.
Writing in plain text, Markdown or HTML
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).
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.
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
- Artiss Code Embed: allows embedding privileged code in posts
- 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
Using privileged elements
By default in WordPress, only users with Administrator privileges can post <audio>, <video>, or <iframe> elements. If non-admin users try to publish posts containing these elements, the elements are stripped out. On Hacks, we now use the 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.