Commit 9261a912 authored by jan.koester's avatar jan.koester
Browse files

test

parent afe4f362
Loading
Loading
Loading
Loading
+4 −1
Changes for editor/src/webedit_api.cpp: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -4703,7 +4703,10 @@ namespace {
    // that's how content-heavy widgets (Textbox, Article, List items, Table cells) store
    // their body text.
    const std::set<std::string> kLlmsTextAttributes = {
        "label", "title", "question", "answer", "alt"
        "label", "title", "question", "answer", "alt",
        "header_label",  // Accordion panel header (accordion.cpp)
        "button_label",  // Popup trigger button text (popup.cpp)
        "survey_title",  // Survey widget's visitor-facing display title (survey.cpp)
    };

    void appendLlmsText(std::string &out, const std::string &text) {
+13 −3
Changes for plugins/staticpage/static.cpp: 13 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ json_object* blogi::StaticPage::newPage(const int tid,libhttppp::HttpRequest& re

    libhttppp::HttpForm form;
    form.parse(req);
    std::string surl,meta,err;
    std::string surl,meta,err,llmsTxt;
    libhtmlpp::HtmlString text;

    try {
@@ -210,6 +210,8 @@ json_object* blogi::StaticPage::newPage(const int tid,libhttppp::HttpRequest& re
                    libhtmlpp::HtmlEncode(data.c_str(),meta);
                }else if(curctdisp.value=="text"){
                    text=data;
                }else if(curctdisp.value=="llms_txt"){
                    llmsTxt=data;
                }
            }
        }
@@ -225,11 +227,12 @@ json_object* blogi::StaticPage::newPage(const int tid,libhttppp::HttpRequest& re
        uuid::uuid id;
        id.generate();

        sql << "INSERT INTO static_content (id,url,meta,text) VALUES('"
        sql << "INSERT INTO static_content (id,url,meta,text,llms_txt) VALUES('"
            << id.c_str() << "\',\'"
            << sql.escaped(sbuf,surl.c_str()) << "\',\'"
            << sql.escaped(sbuf,meta.c_str()) << "\',\'"
            << sql.escaped(sbuf,text.c_str()) <<"\');";
            << sql.escaped(sbuf,text.c_str()) << "\',\'"
            << sql.escaped(sbuf,llmsTxt.c_str()) <<"\');";
        try{
           Args->database[tid]->exec(sql,res);
        }catch(const char *e){
@@ -290,6 +293,13 @@ json_object* blogi::StaticPage::newPage(const int tid,libhttppp::HttpRequest& re
    json_object_object_add(jfText, "value", json_object_new_string(""));
    json_object_array_add(jfields, jfText);

    json_object *jfLlms = json_object_new_object();
    json_object_object_add(jfLlms, "name", json_object_new_string("llms_txt"));
    json_object_object_add(jfLlms, "label", json_object_new_string(tr(_lang,"llms.txt (plain text for AI crawlers)").c_str()));
    json_object_object_add(jfLlms, "type", json_object_new_string("textarea"));
    json_object_object_add(jfLlms, "value", json_object_new_string(llmsTxt.c_str()));
    json_object_array_add(jfields, jfLlms);

    json_object_object_add(jform, "fields", jfields);
    json_object_object_add(jform, "submit", json_object_new_string(tr(_lang,"Save").c_str()));
    json_object_object_add(jroot, "form", jform);