Skip to content
On this page

Asset Naming

Filename Structure

An asset's filename is the combination of the following parts (parts in parentheses are conditional or optional):

[name](-[language_code])(.[flags_seperated_by_dot])[file_extension]

  • The [name] part describes the content the asset is applicable to.
  • The [language_code] part signifies the language version of the content the asset is applicable to. Lack of a language code makes the asset applicable to every language of the website. Currently only WPML based multilingual websites are supported.
  • The [flags_seperated_by_dot] part contains flag values separated by dots.
  • The [file_extension] part informs Enqueueror about the type of the asset and how it should process it.

Content Targeting

The following table contains a list of patterns regarding the [name] part of an asset's filename covering all content targeting scenarios supported by Enqueueror:

ScenarioName PatternExample
Every kind of contentglobalglobal
Content of arbitrary post typetypetype
Specific content by IDtype-id-[id]type-id-1
Specific content by slugtype-slug-[slug]type-slug-home
Content of a specific post typetype-[post_type]type-post
Content of a specific post type by post IDtype-[post_type]-id-[id]type-post-id-1
Content of a specific post type by post slugtype-[post_type]-slug-[slug]type-post-id-post1
Archive of arbitrary taxonomytermterm
Specific term archive by term IDterm-id-[term_id]term-id-1
Specific term archive by term slugterm-slug-[slug]term-slug-category1
Arbitrary term archive of a specific taxonomytax-[taxonomy]tax-category
Specific term archive of a specific taxonomy by term IDtax-[taxonomy]-term-id-[id]tax-category-term-id-1
Specific term archive of a specific taxonomy by term slugtax-[taxonomy]-term-slug-[slug]tax-category-term-slug-category1
Archive of an arbitrary useruseruser
Archive of a specific user by IDuser-id-[user_id]user-id-1
Every type of archivearchivearchive
Date archivearchive-datearchive-date
Archive of a specific post typearchive-type-[post_type]archive-type-post
Search pagesearchsearch
Not found pagenot-foundnot-found

Flags

An asset's filename may contain one or more special keywords called flags which set out how Enqueueror delivers the asset's code in the context of the HTML being served to the browser. The flag part of the filename refers to the [flags_seperated_by_dot] part. The following tables explain the supported flags:

FlagValuesDefaultDescription
Locationhead, bodyheadSpecifies the location in the HTML document that an asset's raw or invocation code will be delivered.
Sourceexternal, internalexternalSpecifies if an asset's code will be loaded from an external file or if it will be outputted as raw code in the intended location in the HTML document.
FlagValueDefaultDescription
LocationheadAsset code will be executed in the head section of the HTML document.
LocationfooterAsset code will be executed in the body section of the HTML document near the </body> tag.
SourceexternalAsset code will be loaded from an external file.
SourceinternalAsset code will be outputted internally in the HTML document as raw code.

INFO

If a flag value has not been set on filename level, the default value of each flag will be used.

EXAMPLES

  • An asset named global.body.external.js or simply global.body.js (external may be omitted due to being the default value of the Source flag) will be loaded from an external file near the end of <body> HTML document section.
  • An asset named global.head.internal.css or simply global.internal.css (head may be omitted due to being the default value of the Location flag) will appear as raw code internally within the <head> HTML document section.

WPML - Multilingual Support

Enqueueror supports WPML based multilingual websites by delivering assets conditionally, depending on the language of the content. The language specifier for an asset refers to the [language_code] part of an asset's filename.

Examples:

ScenarioWPML Language CodeFilename
Global asset - All languagesNoneglobal.css
Global asset - English onlyenglobal-en.css
Global asset - Greek onlyelglobal-el.css
Content of post with ID 1 - All languagesNonetype-post-id-1.css
Content of post with ID 1 - English onlyentype-post-id-1-en.css
Content of post with ID 1 - Greek onlyeltype-post-id-1-el.css