Assets

You would like to include JavaScript or CSS to your site? You can do this with Pagekit without any problems. But: These scripts and styles are always included inline on every page.
This extension allows you to do more.
How to use
Installation
Using this extension is very easy. Just install it from Pagekit's marketplace.
Configuration
After enabling the extension, you can click the "Assets" icon in your backend-menu.
You can now choose between the global configuration (settings), which allows you to enable or disable the caching mode or stay on the assets-page, where you can see your existing assets or add some.
Adding assets
An asset needs to have a type. So if you would like to include some JavaScript, you should choose "JavaScript. If you would like to add CSS, please choose CSS*.
You now might choose the source:
- Inline
- Save Content To File
- URL
If you are choosing "Inline", all your source is added to the head-section of your page. This is fine, but if you are going to include JavaScript, this source can not be executed deferred
or async
.
If you are choosing Save Content To File all the content you added to the editor is saved to a file. You can specify the filename
if you want to. By default the filename is the same as the asset's slug.
Using this method, you can choose deferred
or async
execution. Using "URL"-type, you can include scripts provided by CDN and execute them deferred
or async
, too.
Please notice: Please do not add <script>
or <style>
tags to the content-editor. These tags are being added automatically.
Specify visibility
The Visibility-tab allows you to specify, on which nodes the asset should be added.
Example
Let's assume you need some CSS to change the margin of an element that is only existing in your blog's view. You could add this CSS to the site globally or you could use this extension, create an asset and choose the Visibility-tab to add this CSS only to your blog.
- CMS
- Pagekit
How to fork a theme
Written by Abdulhalim on
spqr/toc updated
Written by Roman on
spqr/toc updated
Written by Nick Sbarounis on