Skip to content

Allow customJS for posts via metadata#262

Open
niklas88 wants to merge 1 commit intokakawait:developfrom
niklas88:custom-js-posts
Open

Allow customJS for posts via metadata#262
niklas88 wants to merge 1 commit intokakawait:developfrom
niklas88:custom-js-posts

Conversation

@niklas88
Copy link

@niklas88 niklas88 commented Mar 29, 2018

This change allows adding custom Javascript to posts in a way analogous to the global site.

To add a Javascript file to a post one only has to add a customJS option to the metadata like so

---
title: "Code Test"
date: 2018-03-28T12:32:57+02:00
draft: false
customJS:
     src: "js/myscript.js"
---
... rest of post ...

I'm not really happy with the code duplication but when I delete the {{ range .Size.Params.customJS }} site wide customJS breaks. So I'm not sure if there's a better way. Also of course this still lacks documentation but I wanted to get a discussion started before writing that.

@kakawait kakawait changed the base branch from master to develop April 6, 2018 16:12
@kakawait
Copy link
Owner

kakawait commented Apr 6, 2018

@niklas88 Thank you for contribution

I think it will be nice to do the same thing for customCSS.

Do you think you can add that addition?

Else no problem I will merge it like that and add after

@kakawait kakawait added this to the 0.4.4-BETA milestone Apr 6, 2018
@kakawait kakawait added enhancement New feature or request waiting for feedback We need additional information before we can continue labels Apr 6, 2018
@kakawait kakawait modified the milestones: 0.4.4-BETA, 0.4.5-BETA Aug 26, 2018
@kakawait kakawait modified the milestones: 0.4.5-BETA, 0.6.0 Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request waiting for feedback We need additional information before we can continue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants