MODX Quick Tip: PDF Content/MIME Type

Apr 18, 2012

MODX Resources are handy things. You can list them with getResources or Wayfinder and do any number of cool things with them, thanks to the Uber-Powerful MODX Framework.

To extend all that functionality to a static resource on your site (like a PDF file) all you have to do is create a Resource with the Class Key of modStaticResource and the corresponding Content Type. These fields are both found on the Page Settings tab when your editing a Resource.

One problem you might run into is that MODX doesn't come with PDF as a default Content Type. This is easy to fix. In MODX's main menu, go to: System ยป Content Types. Click "New Content Type" and in the modal window, enter the following values (see screenshot below)

MODX PDF Content TYpe

Click Save and you're done!

For more information about different Content Types, visit the Library of Congress website.

Here's the MODX Official Documentation on Content Types.