Sign in
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.

  • This topic has 9 replies, 2 voices, and was last updated 8 months, 1 week ago by .
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #10105
    Avatar photoWarroza

    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 photoWarroza

    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.

     

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #10116
    Avatar photoWarroza
    #10122
    Avatar photoBob

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

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #10124
    Avatar photoWarroza

    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.

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #10130
    Avatar photoWarroza
    #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.

    --
    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

    #10133
    Avatar photoWarroza
Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Issue with search window and some code to automation.’ is closed to new replies.