Background

For those who don't know, Galaxie Blog was built on top of BlogCfc, one of the most popular ColdFusion Blog engines. However, BlogCfc was initially built in the early 2000s.

Raymond Camden, the author of BlogCfc, used .ini files to store many variable settings. It was a decent approach, as the blog software was much more straightforward then. It is easier to store dynamic information in the .ini files rather than the database as BlogCfc supported SQL Server, MySql, Oracle, and Access.

After releasing version 1.15, I decided to freeze the use of any new settings in the .ini files. Instead, I incorporated new functionality by using these directives as a quick method until I could finish version 3. After version 3, I decided to keep the directives in place for backward compatibility and because it is still one of the easiest and quickest ways to roll out new functionality.



What is a Galaxie Blog XML Post Directive?

BlogCfc used an XML Post Directive to deliver specific functionality to a blog post, such as wrapping a code block with <code> tags to present code. BlogCfc also used the more tag to condense a post on the landing page that aborted processing the page at a specific position, and created a button that allows the reader to navigate to the complete page.

Since Galaxie Blog 1.15, I have used a handful of additional XML Post Directives to embed optional meta tag information, such as video, and to bypass ColdFusions' Global Script Protection, which is used by my hosting provider.

Note: all of these directives are optional and are only needed for certain occasions, such as including a video, presenting video or code, and bypassing ColdFusion's Global Script Protection, which various ColdFusion hosting providers use.


Original BlogCfc XML Post Directives

  • Including a script tag inside of a blog post
    Surround the JavaScript with an opening <attachScript> block and close the script with </attachScript>
  • Including a custom-style sheet
    Like the attachScript tag above, surround your CSS with an opening <attachStyle> and close the style using </attachStyle>
  • Use <code> tags to format programming code:
    1. Create the initial <code> tag.
    2. Insert the actual code.
    3. Terminate your code block with </code>
  • Use a single  tag to condense the blog body when you're looking at all of the blog posts:
    • Place a tag where you want the body to terminate
  • Real-world example: Scroll down to Kendo Server-Side Validation

SEO XML Post Directives

  • Set the meta title for the individual blog post:
    • Enter the title between the titleMetaTag tags:
    • <titleMetaTag>Galaxie Blog Post Directives</titleMetaTag>
  • Set the description for the individual blog post. This also sets the description when sharing the post on social media sites (i.e. the open graph and Twitter meta tags):
    • Enter the description between the descMetaTag tags:
    • <descMetaTag>How to use post directives in Galaxie Blog</descMetaTag>

Image XML Post Directives

  • Set the image URL for Facebook (i.e., set the value for the og: image):
    • Note: if you upload an enclosure when making a post, Facebook and Twitter images will be automatically created for you.
    • Enter the URL between facebookImageUrlMetaData tags:
    • <facebookImageUrlMetaData>/enclosures/facebook/aspectRatio.jpg</facebookImageUrlMetaData>
  • Set the image URL for Twitter (i.e. set the value for the twitter:image):
    • Note: if you upload an enclosure when making a post, Facebook and Twitter images will be automatically created for you.
    • Enter the URL between the twitterImageUrlMetaData tags:
    • <twitterImageUrlMetaData>/enclosures/facebook/aspectRatio.jpg</twitterImageUrlMetaData>

Video XML Post Directives

  • Set the video type. When the proper video type is encountered, the media player will attempt to play the video:
    • The videoType can be: .mp3, .mp4, .ogg .ogv or .webm
    • Specify the video type between the videoType tags:
    • <videoType>.mp4 </videoType>
  • Set a cover image on top of the video if it is not playing (optional):
    • Specify the URL to the cover image between the videoPosterImageUrl tags:
    • <videoPosterImageUrl>https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg</videoPosterImageUrl>
  • Set the URL to the small source (576p) of a video (optional):
    • It's possible to have a small, medium, and large video source. The code will determine which video source to play depending on the end-user device type (i.e., desktop or mobile). The large video source should be in 576p format.
    • Specify the URL to the medium-sized video between the smallVideoSourceUrl tags:
    • <smallVideoSourceUrl>https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-576p.mp4</smallVideoSourceUrl>
  • Set the URL to the medium source (720p) of a video (optional):
    • It's possible to have a small, medium, and large video source. The code will determine which video source to play depending on the end-user device type (i.e., desktop or mobile). The large video source should be in 720p format.
    • Specify the URL to the medium-sized video between the mediumVideoSourceUrl tags:
    • <mediumVideoSourceUrl>https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-720p.mp4</mediumVideoSourceUrl>
  • Set the URL to the large source (1080p) of a video (optional):
    • It's possible to have a small, medium, and large video source. Depending on the end-user device type (i.e., desktop or mobile), the code will determine which video source to play. The large video source should be in 1080p format.
    • Specify the URL to the medium-sized video between the largeVideoSourceUrl tags:
    • <largeVideoSourceUrl>https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-1080p.mp4</largeVideoSourceUrl>
  • Set the URL to the video captions file (optional):
    • Specify the URL to the video captions VTT file between the videoCaptionsUrl tags:
    • <videoCaptionsUrl>https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.en.vtt</videoCaptionsUrl>
  • Set the cross-origin setting (optional):
    • This optional setting should only be set when the video source is outside your domain. It is set to true only when the video is hosted from another source.
    • Specify the URL to video captions VTT file between the videoCrossOrigin tags:
    • <videoCrossOrigin>true</videoCrossOrigin>
  • Set the video width metadata (optional):
    • This is an optional setting that sets the width in the meta tags. It does not impact the presentation of the video and is only used by Facebook and Twitter.
    • Specify the width in pixels between the videoWidthMetaData tags:
    • <videoWidthMetaData>1920</videoWidthMetaData>
  • Set the video height metadata (optional):
    • This is an optional setting that sets the height in the meta tags. It does not impact the presentation of the video and is only used by Facebook and Twitter.
    • Specify the width in pixels between the videoHeightMetaData tags:
    • <videoHeightMetaData>1080</videoHeightMetaData>

XML Post Directive for YouTube

  • Set the URL to a YouTube Video:

XML Post Directive for Vimeo


XML Post Directives to bypass ColdFusions' Global Script Protection

  • Use a cfinclude:
    • Enter the path to the template that you want to include after the cfincludeTemplate tags:
    • <cfincludeTemplate>/blog/includes/postContent/parallax/parallaxScript.cfm</cfincludeTemplate>
    • Include a javascript inside of a post
      1. Use the initial attachScript, and place the optional script type, if necessary, after attachScript string within a blog post like so:
      2. <attachScript>
      3. Copy and paste the actual javascript
      4. alert("Hello World");
      5. And terminate the script with </attachScript>:
      6. </attachScript>

Note: This article was rewritten for Galaxie Blog 3