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.

Issue with search window and some code to automation.

  • #10105
    Avatar photo[anonymous]

    Hi. I generated site by Publii. My problems are:

    1. Search window doesn’t work. https://warroza.pl

    2. I would like to put some code to the posts body content. I had it before on Blogger and it made for me some automation typography job inside the text. I tried put it to the custom CSS and HTML and it doesn’t work.

    /* Posts
    ----------------------------------------------- */
    
    var text = document.getElementById('post-body').innerHTML;
    text = text.replace(/(\s)([\S])[\s]+/g,"$1$2 "); //jednoznakowe
    text = text.replace(/(\s)([^<][\S]{1})[\s]+/g,"$1$2&nbsp;"); //dwuznakowe
    //tekst = tekst.replace(/(\s)([^<][\S]{2})[\s]+/g,"$1$2&nbsp;"); //trzyznakowe
    document.getElementById('post-body').innerHTML = tekst;

    Anybody could help me maybe?

    #10111
    Avatar photo[anonymous]

    Edit: sorry. I found a solution to search plugin in documentation. So my problem is only with that automation with polish typography in content of posts.

    #10115
    Avatar photoBob

    Does your post have an ID called: post-body?
    If not, try changing the script to:

    <script>
    var elements = document.getElementsByClassName('post__entry');
    for (var i = 0; i < elements.length; i++) {
        var text = elements.innerHTML;
        text = text.replace(/(\s)([\S])[\s]+/g,"$1$2&nbsp;"); //jednoznakowe
        text = text.replace(/(\s)([^<][\S]{1})[\s]+/g,"$1$2&nbsp;"); //dwuznakowe
        //tekst = tekst.replace(/(\s)([^<][\S]{2})[\s]+/g,"$1$2&nbsp;"); //trzyznakowe
        elements.innerHTML = text;
    }
    </script>

    and paste it into the footer via the Custom HTML tool.

    #10116
    Avatar photo[anonymous]
    #10122
    Avatar photoBob

    Unfortunately, the second link does not work; I’m getting a You don’t have access to this service message.

    #10124
    Avatar photo[anonymous]

    Sorry. It was nonpublic because is my old page from I migrated to Publii. Now is temporary public again. Thanks.

    #10128
    Avatar photoBob

    Unfortunately, the editor is truncating my code. Therefore, I’ll place it in the attached text file. You can then paste it into your site using a Custom HTML tool.

    #10130
    Avatar photo[anonymous]
    #10131
    Avatar photoBob

    It seems that your script, which manipulates the contents of the `post__entry` element is causing a problem with the image script that is dedicated to adding the “is-loaded” class to the images.
    So, you need to modify your script to limit the manipulation to e.g. paragraphs or/and headings H1-H6 tags.

    #10133
    Avatar photo[anonymous]