Pārlūkot izejas kodu

major update 0711

jason 2 gadi atpakaļ
vecāks
revīzija
1a7f04b410

+ 7 - 5
backstage/blogs/routes.py

@@ -136,8 +136,8 @@ image: ""\n
 
 @blogs_app.route('/backstage/blogs', methods=['GET'])
 def blog_list():
-    response = requests.get('{}contents?url=/maincategories'.format(PORTAL_SERVER))
-    #print('{}contents?url=/maincategories'.format(PORTAL_SERVER))
+    response = requests.get('{}contents?url=/blog'.format(PORTAL_SERVER))
+    #print('{}contents?url=/blog'.format(PORTAL_SERVER))
     if response.status_code == 200:
         sortedData = sorted(response.json(), key=lambda x: x['date'], reverse=True)
         return render_template('blogs.html',
@@ -278,6 +278,8 @@ def create():
     else:
         transcat = get_trans_title_url_name(form.categories.data)
     transtitle = get_trans_title_url_name(form.title.data)
+    
+    form.image.data.filename = str(uuid.uuid4()).replace('-','') + ".webp"
 
     front_matter = '''---
 meta_title: "{}"\n\
@@ -296,8 +298,8 @@ question_box_intro: "{}"\n\
 ---'''.format(form.title.data, "", form.title.data,
               get_now_time(),
               'true',
-              'maincategories',
-              '/maincategories/{}'.format(transtitle),
+              'blog',
+              '/blog/{}'.format(transtitle),
               form.image.data.filename,
               form.categories.data,
               transcat, "", "", "")
@@ -326,7 +328,7 @@ categories: ["{}"]\n\
               'blog',
               get_trans_title_url_name(request.args["title"]))
 
-    CatPath = UPLOAD_PATH_MAP[0][0]+"../maincategories/" + get_trans_title_url_name(request.args["title"])
+    CatPath = UPLOAD_PATH_MAP[0][0]+"../blog/" + get_trans_title_url_name(request.args["title"])
 
     # print(CatPath)
     if not os.path.exists(CatPath):

+ 6 - 2
backstage/collections/forms.py

@@ -14,12 +14,16 @@ class CollectionCreateForm(FlaskForm):
     coverimg = FileField('封面圖片', validators=[FileRequired(), FileAllowed(['jpg', 'png', 'gif', 'webp'], 'Images only!')])
     bannerimgtext = StringField('封面圖片說明', validators=[DataRequired()])
     homeowner = StringField('屋主', validators=[DataRequired()])
-    size = StringField('坪數', validators=[DataRequired()])
-    bednum = SelectField('格局', choices=['1房', '2房', '3房', '兩房一廳', '三房兩廳','四房兩廳',],validators=[DataRequired()])
+    ownerimg = FileField('屋主照片', validators=[FileRequired(), FileAllowed(['jpg', 'png', 'gif', 'webp'], 'Images only!')])
+    size = SelectField('坪數範圍', choices=['20坪以下', '20-35坪', '35-50坪', '50坪以上'],validators=[DataRequired()])
+    housesize = StringField('坪數', validators=[DataRequired()])
+    bednum = SelectField('格局', choices=['一房', '二房', '三房', '四房', '四房以上'],validators=[DataRequired()])
+    roomcount = StringField('幾房幾廳?', validators=[DataRequired()])
     housetype = SelectField('屋型', choices=['大樓', '透天'], validators=[DataRequired()])
     designer = StringField('設計師', validators=[DataRequired()])
     space = TextAreaField('設計空間', validators=[DataRequired()])
     loc = SelectField('地區', choices=['台北','新北','基隆','桃園','新竹','苗栗','台中','南投','彰化','雲林','嘉義','台南','高雄','屏東','宜蘭','花蓮','台東','澎湖','金門','馬祖','其他'], validators=[DataRequired()])
+    budgetr = SelectField('預算', choices=['59萬以下', '60-79萬', '80-99萬', '100萬以上'],validators=[DataRequired()])
     budget = StringField('總預算', validators=[DataRequired()])
     construction = StringField('建案名稱', validators=[DataRequired()])
     collectiondesc = TextAreaField('作品集描述', validators=[DataRequired()])

+ 16 - 5
backstage/collections/routes.py

@@ -7,6 +7,7 @@ from backstage.utils import get_now_time
 from backstage.utils.routes import create_collection_content, remove_content, get_trans_title_url_name
 from backstage.config import PORTAL_SERVER
 import os
+import uuid
 
 collections_app = Blueprint('collections', __name__)
 
@@ -50,6 +51,12 @@ def create():
     #     csliderimgfilename.append(file.filename)
 
     eng_name = get_trans_title_url_name(form.title.data)
+
+    form.image.data.filename = str(uuid.uuid4()).replace('-','') + ".webp"
+    form.coverimg.data.filename = str(uuid.uuid4()).replace('-','') + ".webp"
+    form.ownerimg.data.filename = str(uuid.uuid4()).replace('-','') + ".webp"
+    form.comment.data.filename = str(uuid.uuid4()).replace('-','') + ".webp"
+
     front_matter = '''---
 meta_title: "{}"\nmeta_description: "{}"\ntitle: "{}"\ndate: {}\n\
 draft: {}\n\
@@ -62,22 +69,26 @@ description: "{}"\n\
 tags: ["{}"]\n\
 banner_img_text: "{}"\n\
 homeowner: "{}"\n\
+owner_img: "img/{}"\n\
 size: "{}"\n\
+house_size: "{}"\n\
 bed_num: "{}"\n\
+room_count: "{}"\n\
 house_cat: "{}"\n\
 designer: "{}"\n\
 space: "{}"\n\
 loc: "{}"\n\
+budget_range: "{}"\n\
 budget: "{}"\n\
 construction: "{}"\n\
 collection_description: "{}"\n\
-collection_slider: "" \n\
+collection_slider: [] \n\
 comment: "img/{}"\n\
----'''.format(form.title.data, form.description.data, form.title.data,
+---'''.format(form.title.data, form.description.data.replace('\r\n','<br>'), form.title.data,
               get_now_time(), 'true', 'collection', '/collection/{}'.format(eng_name),
               form.image.data.filename, form.collectiontitle.data, form.coverimg.data.filename, form.description.data.replace('\r\n','<br>'), form.tags.data,
-              form.bannerimgtext.data, form.homeowner.data, form.size.data, form.bednum.data,
-              form.housetype.data, form.designer.data, form.space.data, form.loc.data,
+              form.bannerimgtext.data, form.homeowner.data, form.ownerimg.data.filename, form.size.data, form.housesize.data, form.bednum.data,
+              form.roomcount.data, form.housetype.data, form.designer.data, form.space.data, form.loc.data, form.budgetr.data,
               form.budget.data, form.construction.data, form.collectiondesc.data.replace('\r\n','<br>'), form.comment.data.filename)
     print(front_matter)
     data = {'frontMatter': front_matter,
@@ -86,7 +97,7 @@ comment: "img/{}"\n\
             'dest': '/collection/{}'.format(eng_name)}
 
     
-    return create_collection_content(data, form.image.data, form.coverimg.data, csliderimg, form.comment.data)
+    return create_collection_content(data, form.image.data, form.coverimg.data, csliderimg, form.comment.data, form.ownerimg.data)
 
 
 @collections_app.route('/backstage/collection/remove', methods=['POST'])

+ 1 - 1
backstage/editor/routes.py

@@ -11,7 +11,7 @@ def editor():
     if "collection" in url: # 作品集
         type = "collection"
         return render_template('editorcollection.html', title='Type Editor', url=url, type=type, bhouse_server=BHOUSE_SERVER)
-    elif "maincategories" in url: # 設計專欄
+    elif "blog" in url: # 設計專欄
         type = "blog"
         return render_template('editorblog.html', title='Type Editor', url=url, type=type, bhouse_server=BHOUSE_SERVER)
     return render_template('editor.html', title='Type Editor', url=url, type=type, bhouse_server=BHOUSE_SERVER)

+ 124 - 16
backstage/static/js/yo.js

@@ -1,7 +1,7 @@
 contentApiUrl = `${PORTAL_SERVER}contents?url=`;
 frontMatters = [];
 contentMatters = [];
-tagOptionIds = ["chousetype", "csize", "cbudget", "cbednum"];
+tagOptionIds = ["chousetype", "csize", "cbudgetr", "cbednum"];
 testImg = [];
 
 var SwfType = {};
@@ -57,7 +57,7 @@ function getHeader(url) {
     if ($("#ctype").val() == "collection") {
       $("#scat").hide();
     } else if (
-      $("#ctype").val() == "maincategories" ||
+      $("#ctype").val() == "blog" ||
       $("#ctype").val() == "blog"
     ) {
       $("#sdesc").hide();
@@ -122,14 +122,57 @@ function writeMd() {
       mdContent = GetMdHeader(frontMatters);
       mdContent += contentMatters.join("\n");
       var formData = new FormData();
+
       var imagefile = document.querySelector("#cfile");
+
       if ($("#ctype").val() == "collection") {
+        var offset1=0; //in case we dont have complete images, we have to offset
+        var offset2=0;
+        var offset3=0;
         var imagefil2 = document.querySelector("#cnewcoverimg");
         var imagefil3 = document.querySelector("#cnewcomment");
+        var imagefil4 = document.querySelector("#cnewownerimg");
+        var imgcount = 1;
+
+        console.log($("#cfile").val());
+        if($("#cfile").val() == "" || $("#cfile").val() == undefined)
+        {
+          offset1=1;
+        }
+        else
+        {
+          formData.append("image" + imgcount.toString(), imagefile.files[0]);
+          imgcount++;
+        }
 
-        formData.append("image1", imagefile.files[0]);
-        formData.append("image2", imagefil2.files[0]);
-        formData.append("image3", imagefil3.files[0]);
+        console.log($("#cnewcoverimg").val());
+        if ($("#cnewcoverimg").val() == "" || $("#cnewcoverimg").val() == undefined)
+        {
+          offset2=1;
+        }
+        else
+        {
+          formData.append("image" + imgcount.toString(), imagefil2.files[0]);
+          imgcount++;
+        }
+
+        console.log($("#cnewcomment").val());
+        if ($("#cnewcomment").val() == "" || $("#cnewcomment").val() == undefined)
+        {
+          offset3=1;
+        }
+        else
+        {
+          formData.append("image" + imgcount.toString(), imagefil3.files[0]);
+          imgcount++;
+        }
+
+        console.log($("#cnewownerimg").val());
+        formData.append("image" + imgcount.toString(), imagefil4.files[0]);
+
+        console.log($("#cfile").val(), $("#cnewcoverimg").val(), $("#cnewcomment").val(), $("#cnewownerimg").val())
+        console.log(offset1, offset2, offset3)
+        console.log(formData)
 
         axios
           .post("/backstage/multiupload/title", formData, {
@@ -140,19 +183,56 @@ function writeMd() {
           .then(({ data }) => {
             console.log("data", data);
             if (data.success == "1") {
+              console.log(data.fileurl);
               var imglinks = data.fileurl.split(";;;");
+              if($("#cfile").val() == "" || $("#cfile").val() == undefined)
+              {
+                //do nothing
+              }
+              else
+              {
+                alert("Replacing header image");
+                mdContent = mdContent.replace(
+                  $("#cfile").val(),
+                  "/img/title/" + imglinks[0]
+                );
+              }
+              if($("#cnewcoverimg").val() == "" || $("#cnewcoverimg").val() == undefined)
+              {
+                //do nothing
+              }
+              else
+              {
+                alert("Replacing cover image");
+                mdContent = mdContent.replace(
+                  $("#cnewcoverimg").val(),
+                  "/img/title/" + imglinks[1-offset1]
+                );
+              }
+              if($("#cnewcomment").val() == "" || $("#cnewcomment").val() == undefined)
+              {
+                //do nothing
+              }
+              else
+              {
+                alert("Replacing comment image");
+                mdContent = mdContent.replace(
+                  $("#cnewcomment").val(),
+                  "/img/title/" + imglinks[2-offset1-offset2]
+                );
+              }
+              if($("#cnewownerimg").val() == "" || $("#cnewownerimg").val() == undefined)
+              {
+                //do nothing
+              }
+              else
+              {
+                alert("Replacing owner image");
               mdContent = mdContent.replace(
-                $("#cfile").val(),
-                "/img/title/" + imglinks[0]
-              );
-              mdContent = mdContent.replace(
-                $("#cnewcoverimg").val(),
-                "/img/title/" + imglinks[1]
-              );
-              mdContent = mdContent.replace(
-                $("#cnewcomment").val(),
-                "/img/title/" + imglinks[2]
+                $("#cnewownerimg").val(),
+                "/img/title/" + imglinks[3-offset1-offset2-offset3]
               );
+              }
             } else {
               console.log("skipped");
             }
@@ -336,7 +416,16 @@ function parseMd(content) {
         );
       }
 
-      if (line.includes("size: ")) {
+      if (line.includes("owner_img: ")) {
+        $("#cownerimg").val(
+          line.replace("owner_img: ", "").replaceAll('"', "")
+        );
+      }
+
+      if (line.includes("house_size: ")) {
+        $("#chousesize").val(line.replace("house_size: ", "").replaceAll('"', ""));
+      }
+      else if (line.includes("size: ")) {
         $("#csize").val(line.replace("size: ", "").replaceAll('"', ""));
       }
 
@@ -344,6 +433,10 @@ function parseMd(content) {
         $("#cbednum").val(line.replace("bed_num: ", "").replaceAll('"', ""));
       }
 
+      if (line.includes("room_count: ")) {
+        $("#croomcount").val(line.replace("room_count: ", "").replaceAll('"', ""));
+      }
+
       if (line.includes("house_cat: ")) {
         $("#chousetype").val(
           line.replace("house_cat: ", "").replaceAll('"', "")
@@ -362,6 +455,10 @@ function parseMd(content) {
         $("#cloc").val(line.replace("loc: ", "").replaceAll('"', ""));
       }
 
+      if (line.includes("budget_range: ")) {
+        $("#cbudgetr").val(line.replace("budget_range: ", "").replaceAll('"', ""));
+      }
+
       if (line.includes("budget: ")) {
         $("#cbudget").val(line.replace("budget: ", "").replaceAll('"', ""));
       }
@@ -543,12 +640,23 @@ function GetMdHeader(result = []) {
     // rContent += 'collection_slider: ['+collection_slider_img+']\n';
     rContent += 'banner_img_text: "' + $("#ccoverimgtxt").val() + '"\n';
     rContent += 'homeowner: "' + $("#chomeowner").val() + '"\n';
+    if (
+      $("#cnewownerimg").val() != "" &&
+      $("#cnewownerimg").val() != undefined
+    ) {
+      rContent += 'owner_img: "' + $("#cnewownerimg").val() + '"\n';
+    } else {
+      rContent += 'owner_img: "' + $("#cownerimg").val() + '"\n';
+    }
     rContent += 'size: "' + $("#csize").val() + '"\n';
+    rContent += 'house_size: "' + $("#chousesize").val() + '"\n';
     rContent += 'bed_num: "' + $("#cbednum").val() + '"\n';
+    rContent += 'room_count: "' + $("#croomcount").val() + '"\n';
     rContent += 'house_cat: "' + $("#chousetype").val() + '"\n';
     rContent += 'designer: "' + $("#cdesigner").val() + '"\n';
     rContent += 'space: "' + $("#cspace").val() + '"\n';
     rContent += 'loc: "' + $("#cloc").val() + '"\n';
+    rContent += 'budget_range: "' + $("#cbudgetr").val() + '"\n';
     rContent += 'budget: "' + $("#cbudget").val() + '"\n';
     rContent += 'construction: "' + $("#cconstruction").val() + '"\n';
     rContent +=

+ 63 - 15
backstage/templates/collections.html

@@ -54,8 +54,8 @@
       寬2048px * 高1365px)</span>
     {{ form.image(class="form-control form-control-lg modal__file") }}
 
-    {{ form.tags.label(class="form-control-label modal__label mb-1") }}
-    {{ form.tags(class="form-control form-control-lg") }}
+    {{ form.tags.label(class="form-control-label modal__label mb-1 d-none") }}
+    {{ form.tags(class="form-control form-control-lg d-none") }}
 
     {{ form.coverimg.label(class="form-control-label modal__label mt-3 mb-1") }} <span class="text-danger">(建議尺寸/比例:
       寬____px * 高____px)</span>
@@ -67,12 +67,21 @@
     {{ form.homeowner.label(class="form-control-label modal__label mt-3 mb-1") }}
     {{ form.homeowner(class="form-control form-control-lg") }}
 
+    {{ form.ownerimg.label(class="form-control-label modal__label mt-3 mb-1") }}
+    {{ form.ownerimg(class="form-control form-control-lg") }}
+
     {{ form.size.label(class="form-control-label modal__label mt-3 mb-1") }}
     {{ form.size(class="form-control form-control-lg") }}
 
+    {{ form.housesize.label(class="form-control-label modal__label mt-3 mb-1") }}
+    {{ form.housesize(class="form-control form-control-lg") }}
+
     {{ form.bednum.label(class="form-control-label modal__label mt-3 mb-1") }}
     {{ form.bednum(class="form-control form-control-lg") }}
 
+    {{ form.roomcount.label(class="form-control-label modal__label mt-3 mb-1") }}
+    {{ form.roomcount(class="form-control form-control-lg") }}
+
     {{ form.housetype.label(class="form-control-label modal__label mt-3 mb-1") }}
     {{ form.housetype(class="form-control form-control-lg") }}
 
@@ -85,6 +94,9 @@
     {{ form.designer.label(class="form-control-label modal__label mt-3 mb-1") }}
     {{ form.designer(class="form-control form-control-lg") }}
 
+    {{ form.budgetr.label(class="form-control-label modal__label mt-3 mb-1") }}
+    {{ form.budgetr(class="form-control form-control-lg") }}
+
     {{ form.budget.label(class="form-control-label modal__label mt-3 mb-1") }}
     {{ form.budget(class="form-control form-control-lg") }}
 
@@ -181,7 +193,7 @@
               </td>
               <td><input class="form-control" id="ctags" type="text" />
               </td>
-            </tr>
+            </tr>--
             <tr>
               <td>
                 <h4>封面圖片</h4>
@@ -207,31 +219,55 @@
             </tr>
             <tr>
               <td>
-                <h4>坪數</h4>
+                <h4>屋主照片</h4>
               </td>
-              <td><input class="form-control" id="csize" type="text" />
+              <td>
+                <input class="form-control" id="cnewownerimg" type="file" />
+              </td>
+            </tr>
+            <tr>
+              <td>
+                <h4>坪數範圍</h4>
+              </td>
+              <td><select id="csize">
+                <option value="20坪以下">20坪以下</option>
+                <option value="20-35坪">20-35坪</option>
+                <option value="35-50坪">35-50坪</option>
+                <option value="50坪以上">50坪以上</option>
+              </select></td>
+            </tr>
+            </td>
+            </tr>
+            <tr>
+              <td>
+                <h4>坪數</h4>
               </td>
+              <td><input class="form-control" id="chousesize" type="text" /></td>
             </tr>
             <tr>
               <td>
                 <h4>格局</h4>
               </td>
               <td><select id="cbednum">
-                  <option value="">格局</option>
-                  <option value="1房">1房</option>
-                  <option value="2房">2房</option>
-                  <option value="3房">3房</option>
-                  <option value="兩房一廳">兩房一廳</option>
-                  <option value="三房兩廳">三房兩廳</option>
-                  <option value="四房兩廳">四房兩廳</option>
-                </select></td>
+                  <option value="一房">一房</option>
+                  <option value="二房">二房</option>
+                  <option value="三房">三房</option>
+                  <option value="四房">四房</option>
+                  <option value="四房以上">四房以上</option>
+                </select>
+              </td>
+            </tr>
+            <tr>
+              <td>
+                <h4>幾房幾廳?</h4>
+              </td>
+              <td><input class="form-control" id="croomcount" type="text" /></td>
             </tr>
             <tr>
               <td>
                 <h4>類型</h4>
               </td>
               <td><select id="chousetype">
-                  <option value="">類型</option>
                   <option value="大樓">大樓</option>
                   <option value="透天">透天</option>
                 </select></td>
@@ -278,7 +314,18 @@
             </tr>
             <tr>
               <td>
-                <h4>預算</h4>
+                <h4>預算範圍</h4>
+              </td>
+              <td><select id="cbudgetr">
+                <option value="59萬以下">59萬以下</option>
+                <option value="60-79萬">60-79萬</option>
+                <option value="80-99萬">80-99萬</option>
+                <option value="100萬以上">100萬以上</option>
+              </select></td>
+            </tr>
+            <tr>
+              <td>
+                <h4>詳細預算</h4>
               </td>
               <td><input class="form-control" id="cbudget" type="text" /></td>
             </tr>
@@ -325,6 +372,7 @@
           <input id="ccollslider" type="text" /><br />
           <input id="ccomment" type="text" /><br />
           <input id="cfile" type="text" /><br />
+          <input id="cownerimg" type="text" /><br />
         </div>
       </div>
 

+ 5 - 0
backstage/templates/editorcollection.html

@@ -5,9 +5,12 @@
   <input id="curl" type="text" /><br />
   <input id="chomeowner" type="text" /><br />
   <input id="csize" type="text" /><br />
+  <input id="chousesize" type="text" /><br />
   <input id="cbednum" type="text" /><br />
+  <input id="croomcount" type="text" /><br />
   <input id="cspace" type="text" /><br />
   <input id="cloc" type="text" /><br />
+  <input id="cbudgetr" type="text" /><br />
   <input id="cbudget" type="text" /><br />
   <input id="cconstruction" type="text" /><br />
   <input id="ccollname" type="text" /><br />
@@ -17,6 +20,8 @@
   <input id="ccolldesc" type="text" /><br />
   <input id="ccoverimg" type="text" /><br />
   <input id="cnewcoverimg" type="text" /><br />
+  <input id="cownerimg" type="text" /><br />
+  <input id="cnewownerimg" type="text" /><br />
   <input id="cnewfile" type="text" /><br />
   <input id="cnewcomment" type="text" /><br />
   <input id="chousetype" type="text" /><br />

+ 2 - 0
backstage/upload/routes.py

@@ -69,6 +69,8 @@ def upload_multi_post(iurl):
         """ if 'file' not in request.files:
             #flash('No file part')
             return redirect(request.url) """
+        print(request.files)
+        print(len(request.files))
         if len(request.files) == 0:
             aa = {"success": 0}
             return aa

+ 8 - 4
backstage/utils/routes.py

@@ -13,12 +13,11 @@ TYPE_URL_FOR = {'collection': 'collections.collection_list',
                 'blog': 'blogs.blog_list'}
 
 def checktype(articletype):
-    if articletype == 'blog':
-        return 'maincategories'
     return articletype
 
 def create_content(data, image_data):
     new_response = requests.post('{}new_content'.format(PORTAL_SERVER), json=data)
+    print("Request returned " + str(new_response.status_code))
     if new_response.status_code == 201:
         #flash('新增文章失敗', 'danger')
         return "<script>alert('已有重複的標題,請重新設定');history.go(-1);</script>"
@@ -32,9 +31,10 @@ def create_content(data, image_data):
             checktype(data.get('type')), get_trans_title_url_name(data.get('name')))))
     else:
         flash('新增文章失敗', 'danger')
+        print(url_for(TYPE_URL_FOR.get(data.get('type'))))
         return redirect(url_for(TYPE_URL_FOR.get(data.get('type'))))
 
-def create_collection_content(data, img, coverimg, csliderimg, commentimg): #exclusive for collection
+def create_collection_content(data, img, coverimg, csliderimg, commentimg, ownerimg): #exclusive for collection
     new_response = requests.post('{}new_content'.format(PORTAL_SERVER), json=data)
     if new_response.status_code == 201:
         #flash('新增文章失敗', 'danger')
@@ -51,6 +51,9 @@ def create_collection_content(data, img, coverimg, csliderimg, commentimg): #exc
             requests.post(
             '{}upload/img_to_dir?url={}&filename={}'.format(
                 PORTAL_SERVER, data.get('dest'), commentimg.filename), files={'image': commentimg})
+            requests.post(
+            '{}upload/img_to_dir?url={}&filename={}'.format(
+                PORTAL_SERVER, data.get('dest'), ownerimg.filename), files={'image': ownerimg})
             sleep(1)
             # reserved for slider img wheel
         return redirect(url_for('editor.editor', url='/{}/{}'.format(
@@ -79,7 +82,8 @@ def remove_content():
 
 
 def get_trans_title_url_name(title):
-    tary = translate(title).replace('$','_').replace('&','_').replace('+','_').replace(',','_').replace('/','_').replace(':','_').replace(';','_').replace('=','_').replace('?','_').replace('@','_').replace(' ','_').replace("'",'_').split('_')
+    title = title.replace('「','').replace('」','').replace('%','_percent')
+    tary = translate(title).replace('$','_').replace('&','_').replace('+','_').replace(',','_').replace('/','_').replace(':','_').replace(';','_').replace('=','_').replace('?','_').replace('@','_').replace(' ','_').replace("'",'_').replace('?','').replace('!','').split('_')
     while("" in tary) :
         tary.remove("")
     return ('_'.join(tary))

+ 1 - 1
models/contents/routes.py

@@ -246,7 +246,7 @@ def gen_content():
     front_matter = request.json.get('frontMatter', '---\n---')
     name = request.json.get('name', 'Undefind')
     if request.json.get('type') == "blog":
-        dir_ = CONTENT_DIR + "/"+ "maincategories" + "/" + name
+        dir_ = CONTENT_DIR + "/"+ "blog" + "/" + name
         if not path.exists(dir_):
             mkdir(dir_)
         if not path.exists(path.join(dir_, 'img')):