Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Tag script js

  • #3736
    Avatar photo[anonymous]

    Hi
    i’m working on moving my site to publii
    I have two questions to ask you

    First question
    in the Block editor the js script tag does not work

    Second question
    in a script tag how to refer to a folder to recall a js function without writing it in the page?

    Thank you very much

    Paolo

    #3737
    Avatar photoBob
    [anonymous] wrote:

    in the Block editor the js script tag does not work

    What exactly isn’t working?

    [anonymous] wrote:

    in a script tag how to refer to a folder to recall a js function without writing it in the page?

    https://getpublii.com/dev/js-helper/

    #3738
    Avatar photo[anonymous]

    Thanks Bob
    i mean the with block editor js code is not executed
    I send you three examples made with different editors
    where you see that with the block editor
    the js code remains text

    http://test.allenati.it/block.html
    http://test.allenati.it/mark.html
    http://test.allenati.it/prova-wisnsing.html

    #3739
    Avatar photoBob

    use an HTML block if you want to execute the script instead of a “script” block which only displays the script.

    #3746
    Avatar photo[anonymous]

    Thanks Bob
    I confirm that in the Block editor, I use the HTML icon and put the script
    between the tags p and p of the html block.
    But then if I look at the online code of the generated post
    “script” becomes “publii-script” and is not interpreted correctly.
    What am I doing wrong? Thanks for your help

    #3751
    Avatar photoBob

    Its a bug in the HTML block, it will be fixed in the upcoming Publii version (most probably publish next week) https://github.com/GetPublii/Publii/issues/815

    #3752
    Avatar photo[anonymous]

    Thanks a lot Bob

    One more about {{js “filepath.js”}} in https://getpublii.com/dev/js-helper/
    I am trying to use the link to the assets directory (which one? Because there are several) e.g \ input \ themes \ simple \ assets \ js?

    #3753
    Avatar photoBob

    This helper is always looking for the script file in the following localization: ‎⁨(Documents ▸ ⁨Publii⁩ ▸ ⁨sites⁩ ▸ ⁨YOUR_SITE ▸ ⁨input⁩ ▸ ⁨themes⁩ ▸ ⁨YOUR_THEME ▸ assets ▸ js)

    #3757
    Avatar photo[anonymous]

    I’m trying to link the w3.js file I put in the foder
    “Documents \ Publii \ sites \ mysite \ input \ themes \ simple \ assets \ js \”
    with the helper src=”{{js” w3.js “}}”
    but it doesn’t work locally
    and in the generated html code remains src=”{{js” w3.js “}}”
    see http://test.allenati.it/helper.html
    can you help me understand the problem
    thank you

    #3758
    Avatar photoBob

    It needs to be embedded in the source files like head.hbs, footer.hbs, or any other, not in the post body.

    <script src="{{js "w3.js"}}"></script>