typecho joe theme optimization log

The blogger used typecho to build the blog site, and also modified and optimized it to a certain extent. Configured as a 1-core 2g lightweight server,
the effect can be seen on the blog homepage: yumuing's blog
is as follows:

image.png

Website loading effect (no full-site CDN):

image.png

It is recommended to use the latest Joe7.7.1 version, which brings faster website loading speed than previous versions

Remove the login button on the front page of the front page. After logging in, the login status will be displayed, and it will disappear if you do not log in.

/usr/themes/Joe/public/header.php
Annotate the html code from line 217 to line 218
, which contains <?php else : ?>the code

as follows:

comment code

Fix the Bug that the article is not included, but it still shows the included Bug

This blog uses the Joe theme, and this problem existed in 7.3.3. Now it has been upgraded to the latest version 7.7.1, and it is found that this problem is still not resolved.
Problem details: No matter what article is included, it is actually not included.
Solution:
Modify the core/route.php file in the theme directory
and add the code on line 143
:

$header[] = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9";
$ch = curl_init();

Add mobile announcement

Effect
Mobile phone announcement
Add the code location of the mobile phone:
/usr/themes/Joe/public/header.php
Add the modified code at line 310, that is,
add it after the following code


<div class="joe_header__slideout-author">
    <img width="50" height="50" class="avatar lazyload" src="<?php _getAvatarLazyload(); ?>" data-src="<?php $this->options->JAside_Author_Avatar ? $this->options->JAside_Author_Avatar() : _getAvatarByMail($this->authorId ? $this->author->mail : $this->user->mail) ?>" alt="博主昵称" />
    <div class="info">
      <a class="link" href="<?php $this->options->JAside_Author_Link() ?>" target="_blank" rel="noopener noreferrer nofollow"><?php $this->options->JAside_Author_Nick ? $this->options->JAside_Author_Nick() : ($this->authorId ? $this->author->screenName() : $this->user->screenName()); ?></a>
      <p class="motto joe_motto"></p>
    </div>
 </div>

Add mobile code:

 <div class = item style="height:30px">
     <svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20">
       <path d="M656.261 347.208a188.652 188.652 0 1 0 0 324.05v-324.05z" fill="#F4CA1C"></path>
       <path d="M668.35 118.881a73.35 73.35 0 0 0-71.169-4.06l-310.01 148.68a4.608 4.608 0 0 1-2.013.46h-155.11a73.728 73.728 0 0 0-73.728 73.636v349.64a73.728 73.728 0 0 0 73.728 73.636h156.554a4.68 4.68 0 0 1 1.94.43l309.592 143.196a73.702 73.702 0 0 0 104.668-66.82V181.206a73.216 73.216 0 0 0-34.453-62.326zM125.403 687.237v-349.64a4.608 4.608 0 0 1 4.608-4.608h122.035v358.882H130.048a4.608 4.608 0 0 1-4.644-4.634zm508.319 150.441a4.608 4.608 0 0 1-6.564 4.193L321.132 700.32V323.773l305.97-146.723a4.608 4.608 0 0 1 6.62 4.157v656.471zM938.26 478.72H788.01a34.509 34.509 0 1 0 0 69.018H938.26a34.509 34.509 0 1 0 0-69.018zM810.01 360.96a34.447 34.447 0 0 0 24.417-10.102l106.245-106.122a34.524 34.524 0 0 0-48.84-48.809L785.587 302.08a34.509 34.509 0 0 0 24.423 58.88zm24.417 314.609a34.524 34.524 0 1 0-48.84 48.814L891.832 830.52a34.524 34.524 0 0 0 48.84-48.809z" fill="#595BB3"></path>
     </svg>
     <a href="https://yumuing.top/" target="_blank" rel="noopener noreferrer nofollow"display: inline-block;>网安备案!关闭本站评论功能!</a>
 </div>

Add visitor information

Effect:
visitor
Tutorial:
Copy the code below
and paste it into the code area at the bottom of the website.
The Joe theme can be directly placed in the global settings—js.
Code:

<!-- 客户端信息 -->    
<div id="fps" style="z-index:5;position:fixed;bottom:3px;left:3px;color:#2196F3;font-size:10px;-webkit-pointer-events: none;    -moz-pointer-events: none;    -ms-pointer-events: none;    -o-pointer-events: none;"></div>    <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/kaliisra/myblogstatic/kehuduan-js/fetch.min.js"></script>    <script src="https://cdn.gmit.vip/layer/3.1.1/layer.js" type="text/javascript" charset="utf-8"></script>    <script>    /*网站打开提醒代码开始*/    $(function(){
    
            if(/*getCookie('msg') !=*/ 1){
    
                var t = document.createElement("a");            t.href = document.referrer;            var msgTitle = t.hostname;            var name = t.hostname.split(".")[1];            if("" !== document.referrer){
    
                    switch (name) {
    
                        case 'bing':                        msgTitle = '必应搜索';                        break;                    case 'baidu':                        msgTitle = '百度搜索';                        break;                    case 'so':                        msgTitle = '360搜索';                        break;                    case 'google':                        msgTitle = '谷歌搜索';                        break;                    case 'sm':                        msgTitle = '神马搜索';                        break;                    case 'sogou':                        msgTitle = '搜狗搜索';                        break;                    default:                        msgTitle =  t.hostname;                };            };            var time = (new Date).getHours();            var msg = '';            23 < time || time <= 5 ? msg = "你是夜猫子呀?这么晚还不睡觉,明天起的来嘛?":            5< time && time <= 7 ? msg = "早上好!一日之计在于晨,美好的一天就要开始了!":            7< time && time <= 11 ? msg = "上午好!工作顺利嘛,不要久坐,多起来走动走动哦!":            11< time && time <= 14 ? msg = "中午了,工作了一个上午,现在是午餐时间!":            14< time && time <= 17 ? msg = "午后很容易犯困呢,今天的运动目标完成了吗?":            17< time && time <= 19 ? msg = "傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~":            19< time && time <= 21 ? msg = "晚上好,今天过得怎么样?":            21< time && time <= 23 && (msg = "已经这么晚了呀,早点休息吧,晚安~");            $.ajax({
    
                    type:"get",                url:"https://api.gmit.vip/Api/UserInfo/",                async:true,                success:function(data){
    
                        window.info = data;                    layer.msg("Hi~ 来自"+ data.data.location + '~<br/>通过 '+msgTitle+' 进来的朋友!<br/>使用 '+ data.data.os +"<br/>"+ data.data.browser +' 访问本站!' + '<br/>' + msg);                    var showFPS = (function(){
    
                            var requestAnimationFrame =                            window.requestAnimationFrame ||                            window.webkitRequestAnimationFrame ||                            window.mozRequestAnimationFrame ||                            window.oRequestAnimationFrame ||                            window.msRequestAnimationFrame ||                            function(callback) {
    
                                    window.setTimeout(callback, 1000/60);                            };                        var e,pe,pid,fps,last,offset,step,appendFps;                         fps = 0;                        last = Date.now();                        step = function(){
    
                                offset = Date.now() - last;                            fps += 1;                            if( offset >= 1000 ){
    
                                last += offset;                            appendFps(fps);                            fps = 0;                            };                            requestAnimationFrame( step );                        };                        appendFps = function(fps){
    
                                var settings = {
    
                                    timeout: 5000,                                logError: true                            };                            $('#fps').html('<span style="float:left;">'+fps+'FPS</span><br/><span style="float:left">'+window.info.data.os+'</span><br/><span style="float:left;margin-top:1px;">'+window.info.data.browser+'</span><br/><span style="float:left;margin-top:1px;">'+window.info.data.location+'</span><br/><span style="float:left;margin-top:1px;"></span>');                        };                        step();                    })();                }            });        };    });    </script> 

Set copy text copyright statement

Effect:
The copyright belongs to the author.
For commercial reprint, please contact the author for authorization, for non-commercial reprint, please indicate the source.
Author: yumuing Blog: A pilgrim of technology
Source: https://yumuing.top/archives/7.html
Link: https://yumuing.top/

Tutorial:
Just put the following code at the bottom of the footer file foot.php or footer.php in the theme.
Then it’s done. If someone else copies your website, there will be a copyright statement. Remember to change the name and website URL in the above code to your own, and you can achieve it.
In joe, the code location is /usr/themes/Joe/public/footer.php. Before
modifying the location to footer.php, the code is as follows:<script>

function setClipboardText(event) {
    
    
    var clipboardData = event.clipboardData || window.clipboardData;
    if (clipboardData) {
    
    
        event.preventDefault();
 
        var htmlData = ''
            + '著作权归作者所有。<br>'
            + '商业转载请联系作者获得授权,非商业转载请注明出处。<br>'
            + '作者:yumuing 博客:做技术的朝拜者<br>'
            + '来源:' + window.location.href + '<br>'
            + '链接:https://yumuing.top/<br><br>'
            + window.getSelection().toString();
        var textData = ''
            + '著作权归作者所有。\n'
            + '商业转载请联系作者获得授权,非商业转载请注明出处。\n'
            + '作者:yumuing 博客:做技术的朝拜者\n'
            + '来源:' + window.location.href + '\n'
            + '链接:https://yumuing.top/\n\n'
            + window.getSelection().toString();
 
        clipboardData.setData('text/html', htmlData);
        clipboardData.setData('text/plain',textData);
    }
}
</script>

website settings

Blogger avatar, Favicon settings: the icon in front of the website tab name

  1. Use https://tool.lu/favicon to make icons. It is recommended that the original favicon image be a PNG image with a transparent background.
  2. Convert image to BASE64 encoding | rookie tool runoob.com for icon Base64 addressing
  3. Upload to background

Image compression is recommended to use: image compression - online tool - OKTools , other websites cannot freely define the compression quality.
Since the icon display area is small, you can use a compression quality of 10

Static resource cdn:

  1. Push the static resources under the joe directory, that is, the assets under joe in the theme directory, to github, set the public and release version, and facilitate static resource management.
  2. Fill in the custom static resource cdn address under joe global settings: https://cdn.jsdelivr.net/gh/your username/your warehouse name@published version number/file path, such as: https:// cdn.jsdelivr.net/gh/yumuing/[email protected]/

Enable gzip compression:
open index.php in the typecho directory, and add ob_start('ob_gzhandler'); at the beginning.

Create and set robots.txt in the root directory of the website to facilitate crawling by search engine crawlers.

User-agent: *
Allow: /*.html$
Allow: /usr
Allow: /*.png$
Allow: /*.jpg$
Allow: /*.jepg$
Allow: /*.gif$
Allow: /*.bmp$
Disallow: /admin/
Disallow: /install/
Disallow: /var/
Disallow: /config.inc.php
Disallow: /install.php
Disallow: /.js
Disallow: /.css
Disallow: /feed
Sitmap: 你的域名/sitemap.xml

You can use your domain name/robots.txt to check whether the setting is successful. Afterwards, the robots.txt update is completed on the Baidu collection platform.
insert image description here

site pseudo static

The Nginx web server sets the pseudo-static rules by calling the file ending with the .conf suffix. Typecho Nginx pseudo-static is as follows:

if !−e$requestfilename {
    rewrite ^.∗/index.php1 last;
}

Copy and paste the pseudo-static rules above, save it as typecho.conf file, and then call it in the website configuration file. Due to the influence of different Nginx installation paths, please refer to the current web environment settings.

Enable address rewriting function:
image.png
If it prompts "Rewriting function detection failed, please check your server settings". Don't worry about it, just turn it on. After enabling the address rewriting function, remember to modify the custom article path to a rule with an html ending.
The address bar will be automatically rewritten to end with html, which is convenient for search engines such as Baidu to include.

plugin list

  • Font library plugin: FontLibs

    Contains the following fonts:

    1. HarmonySanc Hongmeng font
    2. Founder Pixel
    3. Founder Lanting fine black
    4. Founder Northern Wei regular script simplified
    5. Founder thin handsome black Simplified
    6. Han Yi Zhong Kai Jian
    7. Hanyi Jinkai Slips
    8. Han Yi Rough Imitation of Song Bamboo Slips
    9. Character-making workshop Dianhei ultra-fine font
    10. Letter making studio still black regular font
    11. Word making workshop Yueyuan
    12. trendy playful body
    13. Happy Uranus

This blog uses HarmonySanc Hongmeng font, which has fast loading speed and beautiful style.

  • LaTeX plugin: TypechoLaTeX

Because typecho is relatively concise and does not come with LaTeX analysis, it cannot present beautiful mathematical formulas well, so this plug-in is used to solve the problem. The plugin supports two styles of rendering: MathJax and KaTex. Blog in MathJax style.

  • Sitemap plugin: Sitemap

Although Joe has its own site map function, its function is relatively simple and cannot meet the needs. It is recommended to use this plug-in to complete the setting.
function list:

  1. Open Sitemap.xml
  2. Baidu automatic push
  3. Set push priority, update frequency, display control

image.png

  • External link to internal link and short link plug-in: ShortLinks

The more links in the blog website that do not belong to the domain name of the website, the more likely they will not be included by Baidu, so the external links in the website must be converted into links related to the domain name of the website, and forwarded through Nginx, which can be quickly realized by using this plug-in. You can go to yumuing's blog to check the effect . Of course, sometimes some promotional links change frequently, and you need long-term promotion. However, the promotional links are distributed in many places and modification is troublesome. Therefore, you can modify it once by using a custom short link. , modify everywhere.

image.png

  • Supplementary spider plug-in enhanced version

Can record the type of search engine spider, crawling time, crawled pages, and source IP. It is beneficial to monitor the situation of the site being crawled by spiders and understand the habits of spiders. Can provide a lot of reference data for the SEO of the site.

  • PostToBingIndexNow: Bing seo submission plugin

If you need to use the Bing indexNow service, please first enter the Bing to ensure that you can manually submit the URL. Then enter IndexNow to view the key, as follows:
key
copy the key, then download the key file, and upload it to the root directory of the corresponding website on the server, so that you can use the domain name/key name.txt to access it. www.example.com: Your website domain name Enter https://www.bing.com/indexnow?url=http://www.example.com/product.html&key=the key text just copied
in the browser address bar Just send it. Use postman for post submissions. As follows: After the submission is successful, you can view the submitted url at the index of the webmaster background. The specific copy information is as follows:



postman

Content-Type: application/json; charset=utf-8
{
  "host": "www.example.org",
  "key": "894de253b7fd4c8fa75c7367d70f5ec3",
  "keyLocation": "https://www.example.org/894de253b7fd4c8fa75c7367d70f5ec3.txt",
  "urlList": [
      "https://www.example.org/url1",
      "https://www.example.org/folder/url2",
      "https://www.example.org/url3"
      ]
}

Enter the copied key into the key of the corresponding plug-in, and enter the log option as 1.

All resources mentioned in this article are available at typecho joe theme optimization log - yumuing's blog .

Ask for likes and forward

Guess you like

Origin blog.csdn.net/yumuing/article/details/128761619