Sign in

SOLVED: (HREFLANG, Mulitlingual Support) -How to Decode HTML from custom field?

  • This topic has 6 replies, 2 voices, and was last updated 6 days, 14 hours ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #7632
    drunkenboxer

    Hi folks,

    I try to add some custom HTML in the header of a PAGE (so Tools -> custom HTML ist NOT working, because for whole site).

    What I did:

    • I added a custom post.config (textarea) like you can read here
    • I customized head.hbs with code {{@config.post.addInHeader}} on the right place
    • I added <link rel=”alternate” hreflang=”en” href=”https://www.example.com/en&#8221; /> in the field
    • It works, but…

    Problem:

    HTML entities are encoded. I need to decode.

    While I write, I found the solution, but I write it down here, because I saw more questions regadring HREFLANG, Multilingual, etc. This could be a solution for that!

    You have to use 3 braces, not only 2:

    {{{@config.post.addInHeader}}}

    So, here is my solution for Multilingual Support:

    1. Open theme -> config.json
    2. Find “postConfig”-Section
    3. Insert code at the end of the section:
      {
          "name": "addInHeader",
          "label": "Insert Tags in Post-Header",
          "value": "",
          "type": "textarea"        
      }
      
    4. Open C:\Users\yourUserName\Documents\Publii\sites\mypagecom\input\themes\ (How to handle overrides)
    5. Create folder {{theme}}-override
    6. Copy sites\mypagecom\input\themes\<span style=”color: #ff0000;”>{{theme}}</span>\partials\header.hbs to sites\mypagecom\input\themes\<span style=”color: #339966;”>{{theme}}-override</span>\partials\header.hbs
    7. Add {{{@config.post.addInHeader}}} directly before closing Head-Tag.
    8. Save, Close and RESTART publii.

     

    #7638
    seb_oi

    I think I’m not understanding the process very well.

    Where exactly is the header.hbs file? I only find the file head.hbs

    #7639
    seb_oi

    @drunkenboxer

    I am trying to do the process as you say and I am not getting it to work. How do you change language? Don’t we have to add some icons with the flags or something? I have done the whole process modifying the head instead of header but it doesn’t work.

    Greetings and thanks first of all

    #7641
    drunkenboxer

    I think I’m not understanding the process very well.

    Where exactly is the header.hbs file? I only find the file head.hbs

     

    I am sorry, must be HEAD.hbs, not header.hbs.  😳

    #7642
    drunkenboxer

    @drunkenboxer

    I am trying to do the process as you say and I am not getting it to work. How do you change language? Don’t we have to add some icons with the flags or something? I have done the whole process modifying the head instead of header but it doesn’t work.

    Greetings and thanks first of all

    I wrote a long tut for ONE possivle solution, but unfortunally wordfence does not to want to make me publish it 🙁

    #7651
    seb_oi

    @drunkenboxer

    I am trying to do the process as you say and I am not getting it to work. How do you change language? Don’t we have to add some icons with the flags or something? I have done the whole process modifying the head instead of header but it doesn’t work.

    Greetings and thanks first of all

    I wrote a long tut for ONE possivle solution, but unfortunally wordfence does not to want to make me publish it 🙁

     

    Thank you very much for your answer. I’m waiting to see if with a bit of luck we can fix it.

    And thank you very much for your solution.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.