1. Halo Guest, pastikan Anda selalu menaati peraturan forum sebelum mengirimkan post atau thread baru.

Cara me-SEO kan blog wordpressanda Tanpa AIO SEO pack plugin

Discussion in 'Wordpress' started by aminhidayat, Mar 26, 2011.

  1. aminhidayat

    aminhidayat Super Hero

    Joined:
    Jul 24, 2008
    Messages:
    1,678
    Likes Received:
    76
    Location:
    tokopedia
    Sedikit share mungkin berguna untuk Anda.
    Selain permalink, <title> juga penting untuk me-SEO kan blog anda. Jika di single page <title> di blog anda adalah :

    www.namabloganda.com >> judul posting

    mau di ubah :

    judul posting | www.namabloganda.com


    caranya:

    pakai ftp : public_html > wp-admin > themes > namathemes > header.php

    ubah:

    PHP:
    <title>

    <?php bloginfo('name'); ?>

    <?php wp_title(); ?>
    </title>
    menjadi:

    PHP:
    <title>
    <?php wp_title(' | ',true,'right'); ?>

    <?php bloginfo('name'); ?>
    </title>
    selamat mencoba
     
  2. turtle

    turtle Hero

    Joined:
    Mar 13, 2010
    Messages:
    582
    Likes Received:
    134
    Location:
    Semarang, Indonesia
    kurang lengkap bro..
    :)
     
  3. r4tn4

    r4tn4 Super Hero

    Joined:
    Mar 31, 2006
    Messages:
    3,828
    Likes Received:
    2,668
    Location:
    https://www.tikie.online
    nice share mas,...
    tapi menurut saya jadi gak praktis, dengan adanya AIO SP kita udah dibikin mudah tanpa harus bongkar2 themes, kecuali untuk alasan lain seperti menghemat resource CPU,.. mungkin tips dari mas amin bisa dipake.
     
  4. amrimf

    amrimf Super Hero

    Joined:
    Jul 4, 2009
    Messages:
    2,915
    Likes Received:
    172
    Location:
    Purwokerto
    Kalo ane malah di meta keyword ma descriptionnya yang pake koding sendiri, tapi emang lebih puas jadinya
     
  5. titah

    titah Ads.id Pro

    Joined:
    May 16, 2010
    Messages:
    456
    Likes Received:
    24
    Location:
    gunung lawu
    sekalian dishare mas :senyum:
     
  6. ddl4fun

    ddl4fun Super Hero

    Joined:
    Feb 25, 2009
    Messages:
    1,908
    Likes Received:
    105
    Location:
    /
    hemat CPU, hemat Query, hemat waktu, setting2 aio sp njelimet kadang, kalau udah bikin rumus, kan tinggal di bikin di theme2 laen :D

    setuju, mungkin bisa ditambahin dengan konditional yah dihalaman single, tag atau keyword atau mau dua duanya...
     
  7. aminhidayat

    aminhidayat Super Hero

    Joined:
    Jul 24, 2008
    Messages:
    1,678
    Likes Received:
    76
    Location:
    tokopedia
    itu sudah berubah semuanya :) gak percaya coba sendiri aja :senyum:
     
  8. comsoft

    comsoft Super Hero

    Joined:
    Mar 1, 2011
    Messages:
    902
    Likes Received:
    102
    Location:
    Jakarta
    makasih sharenya, tapi lebih mudah pke plugin :)
     
  9. topjitu

    topjitu Super Hero

    Joined:
    Aug 22, 2009
    Messages:
    777
    Likes Received:
    324
    Location:
    Bumi Allah
    mantap gan mau di coba nunggu uji coba pertama kelar dulu gan... ntar kl g berhasil mau nyoba yang ni dulu.. bookmark dulu dah..
     
  10. cicak

    cicak Ads.id Pro

    Joined:
    May 22, 2010
    Messages:
    288
    Likes Received:
    1
    cocok buat alternatif :)
     
  11. alhafizhi

    alhafizhi Super Hero

    Joined:
    Feb 3, 2011
    Messages:
    1,276
    Likes Received:
    198
    Location:
    Banjarmasin
    d share juga gan tuk meta key n descrip nya
     
  12. titah

    titah Ads.id Pro

    Joined:
    May 16, 2010
    Messages:
    456
    Likes Received:
    24
    Location:
    gunung lawu
    Tambahin di functions.php

    PHP:
    function meta_seo() {
        
    $desc_length  30
        
    $use_excerpt  1;
        
    $key   'diskripsi';
        global 
    $cat$cache_categories$wp_query$wp_version;
        if((
    is_single() || is_page())&& !is_attachment())  {
            
    $post $wp_query->post;
            
    $post_custom get_post_custom($post->ID);
            
    $custom_desc_value $post_custom["$key"][0];
            if(
    $custom_desc_value) {
                
    $text $custom_desc_value;
            } elseif(
    $use_excerpt && !empty($post->post_excerpt)) {
                
    $text $post->post_excerpt;
            } else {
                
    $text $post->post_content;
            }
            
    $text str_replace(array("\r\n""\r""\n""  "), " "$text);
            
    $text str_replace(array("\""), ""$text);
            
    $text trim(strip_tags($text));
            
    $text explode(' '$text);
            if(
    count($text) > $desc_length) {
                
    $l $desc_length;
                
    $more '...';
            } else {
                
    $l count($text);
                
    $more '';
            }
            
    $description '';
            for (
    $i=0$i<$l$i++)
            
    $description .= $text[$i] . ' ';
            
    $description .= $more;
            
            if(
    $description) {
                echo 
    "<meta name=\"description\" content=\"$description\" />\n";
            }
            
    $postTags get_the_tags();
            if(
    $postTags){
            
    $tagNames = array();
            foreach(
    $postTags as $tag) {
                
    $tagNames[] = $tag->name;
                }
            }
            
    $kiword implode($tagNames,", ");
            if(
    $kiword) {
                echo 
    "<meta name=\"keywords\" content=\"$kiword\" />\n";
            }
        }
        elseif  (
    is_paged() || is_day() || is_month() || is_year()) {
            echo 
    "<meta name=\"robots\" content=\"noindex,follow\" />\n";
        }
    }
    trus tambahin di header.php sebelum </head>

    PHP:
    <?php meta_seo(); ?>
    yg terjadi?


    Di single post dan page akan generate 30 kata buat diskripsi
    kalo mau pake deskripsi sendiri tinggal pake custom field diskripsi
    tag dipakai buat meta kiword
    no index for paged
    no index archives


    kalo mau auto generate deskripsi doang, ambil aja yg ini

    PHP:
    function meta_seo() {
        
    $desc_length  30
        
    $use_excerpt  1;
        
    $key   'diskripsi';
        global 
    $cat$cache_categories$wp_query$wp_version;
        if((
    is_single() || is_page())&& !is_attachment())  {
            
    $post $wp_query->post;
            
    $post_custom get_post_custom($post->ID);
            
    $custom_desc_value $post_custom["$key"][0];
            if(
    $custom_desc_value) {
                
    $text $custom_desc_value;
            } elseif(
    $use_excerpt && !empty($post->post_excerpt)) {
                
    $text $post->post_excerpt;
            } else {
                
    $text $post->post_content;
            }
            
    $text str_replace(array("\r\n""\r""\n""  "), " "$text);
            
    $text str_replace(array("\""), ""$text);
            
    $text trim(strip_tags($text));
            
    $text explode(' '$text);
            if(
    count($text) > $desc_length) {
                
    $l $desc_length;
                
    $more '...';
            } else {
                
    $l count($text);
                
    $more '';
            }
            
    $description '';
            for (
    $i=0$i<$l$i++)
            
    $description .= $text[$i] . ' ';
            
    $description .= $more;
            
            if(
    $description) {
                echo 
    "<meta name=\"description\" content=\"$description\" />\n";
            }
            
        }
    }
     
  13. aminhidayat

    aminhidayat Super Hero

    Joined:
    Jul 24, 2008
    Messages:
    1,678
    Likes Received:
    76
    Location:
    tokopedia
    Great..... mastah.... :gembira:
     
  14. nodali

    nodali Ads.id Fan

    Joined:
    Jan 13, 2010
    Messages:
    230
    Likes Received:
    22
    Masih banyak lagi gan...

    Contohnya, membuat canonical link...
    Meng-auto generate desc.., dll deh...
     
  15. compenys

    compenys Ads.id Pro

    Joined:
    Nov 25, 2010
    Messages:
    421
    Likes Received:
    17
    Location:
    jombang
    wah ..ini yang uwa cari thanks banget gans jadi semangat lagi ...:semangat!:
     
  16. fikrionline

    fikrionline PASTI SUKSES

    Joined:
    Jan 2, 2010
    Messages:
    1,355
    Likes Received:
    146
    Location:
    Indonesia
    Kalau saya sendiri biasanya tetap menggunakan Platinum SEO Pack plus tambahkan kode di bawah ini pada file header.php, di atas kode </head>
    PHP:
    <?php // Add link canonical for Search and 404 Page
        
    function fix_permalink($s){
            
    $s strtolower($s);
            
    $s preg_replace('/&.+?;/'''$s); 
            
    $s preg_replace('/\s+/''-'$s); //Change (-) with (+) if your permalink use (+) permalink
            
    $s preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|''-'$s); //Change (-) with (+) if your permalink use (+) permalink
            
    $s preg_replace('|-+|''-'$s); //Change (-) with (+) if your permalink use (+) permalink
            
    $s preg_replace('/&#?[a-z0-9]+;/i','',$s); 
            
    $s preg_replace('/[^%A-Za-z0-9 _-]/''-'$s); //Change (-) with (+) if your permalink use (+) permalink
            
    $s trim($s'-'); //Change (-) with (+) if your permalink use (+) permalink
            
    return $s;
        }
        if (
    is_search()) { 
            echo 
    '<link rel="canonical" href="http://'.$_SERVER["HTTP_HOST"].'/search/'.fix_permalink($s).'" />';
        }
        if (
    is_404()) { 
            
    ?><link rel="canonical" href="<?php echo 'http://'.$_SERVER["HTTP_HOST"].''.$_SERVER["REQUEST_URI"].''?>" /><?php
        
    }
        
    // Add meta keyword to 404
        
    function fix_meta_keyword($keyuri){
            
    $keyuri strtolower($keyuri);
            
    $keyuri preg_replace('/&.+?;/'''$keyuri); 
            
    $keyuri preg_replace('/\s+/'' '$keyuri); //Change (-) with (+) if your permalink use (+) permalink
            
    $keyuri preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|'' '$keyuri); //Change (-) with (+) if your permalink use (+) permalink
            
    $keyuri preg_replace('|-+|'' '$keyuri); //Change (-) with (+) if your permalink use (+) permalink
            
    $keyuri preg_replace('/&#?[a-z0-9]+;/i','',$keyuri); 
            
    $keyuri preg_replace('/[^%A-Za-z0-9 _-]/'' '$keyuri); //Change (-) with (+) if your permalink use (+) permalink
            
    $keyuri trim($keyuri' '); //Change (-) with (+) if your permalink use (+) permalink
            
    return $keyuri;
        }
        if (
    is_404()) { 
            
    ?><meta name="keyword" content="<?php echo fix_meta_keyword($_SERVER["REQUEST_URI"]); ?>" /><?php
        
    }
    ?>

    <?php /* Add meta description to all pages in wordpess */ ?>
    <?php 
    if (is_year()) { ?>
    <meta name="description" content="This is archive on <?php echo (str_replace("  "," "wp_title(''false'right'))); ?>from  <?php bloginfo('name'); ?>. If you want find best article, you found the best article here!" />
    <?php } elseif (is_day()) { ?>
    <meta name="description" content="Article on publich by our writers on <?php echo (str_replace("  "," "wp_title(''false'right'))); ?>in <?php bloginfo('name'); ?>" />
    <?php } elseif (is_month()) { ?>
    <meta name="description" content="Archive month by month on <?php echo (str_replace("  "," "wp_title(''false'right'))); ?>in <?php bloginfo('name'); ?>" />
    <?php } elseif (is_tag()) { ?>
    <meta name="description" content="Sub topics <?php echo (str_replace("  "," "wp_title(''false'right'))); ?> may be read by visitors in <?php bloginfo('name'); ?>! If you want to read other topic you may click other topics on bellow!" />
    <meta name="keyword" content="<?php echo (str_replace("  "," "wp_title(''false'right'))); ?>" />
    <?php } elseif (is_category()) { ?>
    <meta name="description" content="<?php echo (str_replace("  "," "wp_title(''false'right'))); ?>posting in <?php bloginfo('name'); ?>. Do you have opinion about this category?" />
    <meta name="keyword" content="<?php echo (str_replace("  "," "wp_title(''false'right'))); ?>" />
    <?php } elseif (is_search()) { ?>
    <meta name="description" content="This is best search result with keyword <?php the_search_query(); ?> on <?php echo date("j").' bulan '.date("F").' tahun '.date("Y").' jam '.date("H:i").' WIB' ?>! You may read all article below. Hope you find the best sources here!" />
    <meta name="keyword" content="<?php the_search_query(); ?>" />
    <?php } elseif (is_404()) { ?>
    <meta name="description" content="We are sorry because your search in our criteria in <?php bloginfo('name'); ?>, please find the best other article bellow." />
    <?php ?>
    Ada yang mau nambahin?

    :senyum: :senyum: :senyum:
     
  17. adit4017

    adit4017 Newbie

    Joined:
    Sep 16, 2011
    Messages:
    30
    Likes Received:
    5
    ini nih yg saya cari2, baru nemu :)
    makasih gan ilmunya . :salaman:
     
  18. keyzia123

    keyzia123 Banned

    Joined:
    Aug 25, 2012
    Messages:
    92
    Likes Received:
    0
    Location:
    Banjarbaru
    nice share mastah, ane coba
     

Share This Page