How To: Solve duplicate content in WordPress without plugins Kā: Atrisiniet dublēt saturs WordPress bez plugins

ADVERTISEMENT REKLĀMA
To get our software and web/tips via email, sign up for Lai veicinātu mūsu programmatūru un web / padomus pa e-pastu, pierakstīties daily email newsletter ikdienas e-pasta biļetens . .
Subscribe to RSS feed Subscribe to RSS feed or vai follow me sekojiet man on Twitter? on Twitter?

Duplicate content is a serious issue for all WordPress blogs, and most bloggers now employ different methods to show partial content. Duplicate saturs ir nopietns jautājums visiem WordPress blogus, un lielākā daļa blogeri tagad izmantot dažādas metodes, lai pierādītu, daļēji saturu. The only blogs with good search rankings which employ full posts, are usually authority blogs, which are labelled as safe and authoritative by Google's algorithm. Tikai blogus ar labu meklēšanas sarakstos, kas nodarbina pilnu posts, parasti ir iestāde, blogus, kas ir marķēti kā drošu un uzticamu Google algoritms.

Plugins are a popular method to reduce duplicate content. Plugins ir tautas metode, lai samazinātu dublikāta saturu. However, plugins are not Tomēr, plugins nav fully optimized pilnībā optimizēta , and consumes more server resources than the simple <?php the_excerpt() ?> tag. , Un patērē vairāk servera resursu, nekā vienkāršs <?php the_excerpt() ?> Tag. Moreover, excerpt tag can use the customized post summary that you may have written. Turklāt izvilkums fràzi var izmantot pielāgoto pastu kopsavilkumu, ka Jums varētu būt rakstīta.

In this short tutorial, you should have all the template files in one place. Šajā īsajā apmācība, jums ir visi faili veidnes vienuviet. Once you have those files(probably downloaded from your server, or a local copy that you keep), follow these easy steps: Kad esat šo failu (iespējams lejupielādēt no servera, vai lokālo kopiju, kuru glabā), izpildiet šos soļus:

ADVERTISEMENT REKLĀMA

  • Open up index.php , archive.php and search.php Atvērt index.php archive.php un search.php
  • In each of these files, search and find the code bit that contains <php the_content Katrā no šiem failiem, meklēt un atrast kodu bit, kas satur <php the_content
  • Replace the entire tag – usually <?php the_content(__('Read the rest of this entry'));?> (may change depending on theme, but will be similar), with this tag: Aizvietot visu tagu - parasti <? Php the_content (__(' Lasīt pārējo šī ieraksta'));?> (var mainīties atkarībā no tēmas, bet būs tamlīdzīgi), ar šo tagu:
    <?php the_excerpt();?> <? php the_excerpt ();?>
    Save the files. Saglabàtu failu.
  • Open up index.php again, and save it as category.php (do not discard index.php ). Atvērt index.php atkal, un saglabājiet to kā category.php (Neizmetiet index.php

In the above steps, we have replaced the content tag with the excerpt tag so that only a short paragraph of the post is shown on pages other than the post page. Ar iepriekš minēto pasākumu, mums ir aizstāts saturs tagu ar excerpt tagu tā, ka tikai īsu daļu pastu tiek parādīts lapas, kas nav pasta lapā. Most themes lack a category.php , and its absence can allow full posts on category pages. Visvairāk tēmas trūkums category.php un tās trūkums var atļaut pilnīgi amatu pēc kategorijas lapās. By duplicating the index.php file(which has excerpt tag), that problem is also solved. Ar kopēšanas index.php failu (kas ir ekscerpēt tag), šī problēma ir atrisināta.

Open Mic Open Mic

How do you prevent duplicate content? Kā jūs nepieļautu dublikātu saturu? Do you use this method, or any plugins? Vai jūs izmantojat šo metodi, vai plugins? If so, why do you prefer it over the excerpt tag?(I'd like to hear, as I am myself confused at which method to choose). Ja tā, kāpēc jūs gribētu to pa excerpt tagu? (Es gribētu dzirdēt, kā es esmu sevi sajaukusi ar kuru metodi izvēlēties). Do tell me your views through comments. Vai man pateikt savu viedokli, sniedzot komentārus.

To get our latest articles, Lai veicinātu mūsu jaunākos rakstus, click here to sign up noklikšķiniet šeit, lai piereģistrētos for our free email newsletter or subscribe to mūsu bezmaksas informatīvais biļetens e-pastu vai parakstīties uz RSS feed RSS feed

§ Comments § Komentāri
  • Nirmal says: Nirmal saka:

    This is exactly what I have been doing. Tas ir tieši tas, ko esmu dara. Use post excerpts. Izmantojiet post fragmentāri.

  • Sumesh says: Sumesh saka:

    @Nirmal: Glad to hear your opinion. @ Nirmal: Glad dzirdēt jūsu viedokli. Could you be more specific as to why you prefer it? Vai jūs varētu būt konkrētāki, kāpēc jūs tam dod priekšroku?

  • Karthik says: Karthik saka:

    Funny to run into this, I'd just blogged about something similar yesterday! Smieklīgi skrien, es gribētu tikai blogged par kaut ko līdzīgu vakar! And you did this 2 days earlier – guess it was a repeat for you to read my feed then! Un jūs to izdarīja 2 dienas agrāk - laikam tā bija atkārtot, lai jūs varētu izlasīt manu barību tad!
    [Goes over to subscribe to your feed] [Ies pa parakstīties uz Jūsu barības]

    But I'd just like to make one clarification though – you won't need category.php if you have archive.php or index.php (err, you'd certainly have this one!). Bet es tikai vēlos darīt vienu precizējumu, lai gan - Jums nenāksies category.php ja jums ir archive.php vai index.php (err, jūs, protams, ir tas viens!). What I meant was – if you are going to show excerpts on index.php, you can avoid having archive.php and category.php altogether – don't ask me why not, saves you 4kb on your webspace Ko es gribēju bija - ja jūs gatavojaties pierādīt fragmentāri uz index.php, jūs varat izvairīties no archive.php un category.php pavisam - neprasi man, kāpēc ne, ietaupa jūsu 4KB jūsu webspace ;)

    The order is: Secība ir šāda:
    1. 1. category-xx.php kategorijas xx.php
    2. 2. category.php category.php
    3. 3. archive.php archive.php
    4. 4. index.php index.php

    If you'd like to make one particular category look unique, you can create a file with the category-CATEGORYNUMBER.php and that particular category would follow this template. Ja jūs vēlaties veikt vienu noteiktu kategoriju meklēt unikāls, varat izveidot failu ar kategorijas CATEGORYNUMBER.php, un ka īpaša kategorija attiektos sekot šai veidnei. If it doesn't find this file, it will check if the next file in the hierarchy is there and so on. Vai tas nav atrast šo failu, tā pārbaudīs, vai nākamo failu hierarhija ir tur, un tā tālāk.

    Sorry about the overly long comment, I had to make myself clear! Atvainojos par pārāk garš komentāru, man bija darīt sevi skaidrs!

  • Sumesh says: Sumesh saka:

    @Karthik: No problem whatsoever about long comments – I love 'em! @ Karthik: nekāda problēma, par ilgi piezīmes - I love 'em!
    Well, that thing about category-xx.php was something new to me, thanks. Nu, ka lieta, par kategorijas xx.php bija kaut kas jauns man, paldies. And category no. Un kategorija Nr. means its ID, right? ir tās ID, vai ne?
    As for 4kB webspace, lol Kā 4KB webspace, lol : D

  • Karthik says: Karthik saka:

    Yup, sorry, I should have mentioned ID there! Yup, piedodiet, es būtu minētas ID there!

  • Sumesh says: Sumesh saka:

    @Karthik: No problem, its understood. @ Karthik: Nav problēmu, tās saprast. Now that you've clarified it, readers will also understand. Tagad, kad esat precizēt to, lasītājiem būs arī saprast.

  • Fred Schebesta says: Fred Schebesta saka:

    My recommendation would be to do this but also have unique content in the excerpt. Mans ieteikums būtu darīt, bet arī unikālu saturu izrakstā.

    I have actually switched categories off entirely and have opted for pages instead. Man ir faktiski ieguva kategorijas off kopumā un ir izvēlējušies lappuses vietā.

    (Note the blog above is not an example of this ;-D ) (Piezīme blog iepriekš nav piemērs,-D)

  • § Leave a Reply § Atstāt Atbildēt