Home › Forum › Plugin e temi di WP › Modificare codice singola pagina
-
AutorePost
-
-
1 Giugno 2016 alle 13:08 #30893WillSmith7Partecipante
Salve, ho bisogno di modificare il codice per il rel=canonical ad una singola pagina del mio blog WordPress, ma non sono capace di farlo perchè non so il php e dissezionare il mio tema è troppo complicato. Esiste un plugin che mi permetta di fare ciò per singole pagine o un qualsiasi altro modo semplice per modificare il codice? Grazie in anticipo
-
1 Giugno 2016 alle 17:48 #120553TittiModeratore
àˆ per il sito tech4d.it?
-
1 Giugno 2016 alle 21:36 #120555WillSmith7Partecipante
Esattamente
-
1 Giugno 2016 alle 22:33 #120556WillSmith7Partecipante
La pagina che dovrei modificare è lei http://www.tech4d.it/page/2/ e devo mettere al suo interno un rel=canonical che imposta la home page. Che ne dite se aggiungo questo codice tra <head> e </head> nel file header.php del tema?
<?php
if ( is_page(‘/page/2/) )
echo ‘<link rel=”canonical” href=”www.tech4d.it” . home_url( ‘/’ ) . ‘” />’;
?>
L’ho modificato da un altro codice is_home_page, quindi potrebbe essere tranquillamente sbagliato, e ovviamente non oserò inserirlo nel sito finchè non avrò la sicurezza che sia giusto
-
2 Giugno 2016 alle 9:20 #120557TittiModeratore
A parte che quel codice è pieno di errori di sintassi (e poi si tratta di una pagina impaginata, non di una pagina), ma anche corretto non funzionerebbe perché è il plugin di SEO che hai attivato che ti mette il rel=canonical, quindi dovresti lavorare su quello semmai – per quale motivo “dovresti” fare una cosa del genere?
Perché hai installato un plugin come Yoast e poi vuoi attuare una manovra cosଠanti-SEO?
Credo che tu non abbia presente come si usa il canonical (per evitare contenuti duplicati ad es., cosa che qui non è perché si tratta solo di articoli più vecchi, non di pagina duplicata), leggi qui per chiarirti le idee.
Se proprio non vuoi indicizzare quegli articoli, imposta il “noindex” nelle sotto-pagine degli archivi nelle impostazioni del plugin di Yoast che hai attivo, e hai già risolto.
-
2 Giugno 2016 alle 13:58 #120558WillSmith7Partecipante
Allora, ti spiego. Su Google Search Console, in Miglioramenti HTML, mi è apparso questo errore in “Title duplicati” e “Meta description duplicate”:
/
/page/2/
Non è che siano realmente contenuti duplicati, è Google che le riconosce come tali e se non risolvo mi penalizza. Per risolvere questo errore dovrei modificare il codice SOLO della pagina 2 (o al massimo anche della pagina 3) inserendo come canonical la homepage (quindi con l’apposito codice che contiene rel=canonical href=www.tech4d.it), per far capire a Google che non è un duplicato. Sei sicuro si tratti di una manovra anti SEO? Perchè molti la suggeriscono come soluzione al problema. Il codice è sbagliato e hai ragione, capisco quindi che dovrei agire sul plugin Yoast. Ma cosa devo fare di preciso? Quale file di Yoast devo modificare e che codice devo inserire?
Un modo alternativo sarebbe quello di aggiungere %%pagenumber%% al title delle pagine a partire dalla home per differenziarle (anche se non sono sicuro che risolva il problema contenuti duplicati). Yoast mette a disposizione un campo per modificare il title della home, gli aggiungo pagenumber ma poi appare un fastidioso “Pagina 1” anche sulla Home, e sono punto e a capo perchè non so rimuovere nemmeno quello tramite php.
Vorrei cercare di mantenere indicizzate tutte le pagine ed evitare i noindex, ecco perchè sto cercando di risolvere in questi modi.
-
2 Giugno 2016 alle 17:27 #120559TittiModeratore
La prossima volta spiega subito nel primo post e al meglio che puoi il problema e il fine: è il modo corretto di porgere questioni invece che arrivarci a pezzi e bocconi.
Come già detto forzare il rel=canonical serve soprattutto per le pagine con contenuti duplicati, non titoli o descrizioni, ma per tutto o gran parte del contenuto visibile nella pagina. àˆ evidente che oltre alla mia risposta non hai letto neanche il link che ti ho dato, e quindi non continuerò oltre dopo questa.
Vorrei cercare di mantenere indicizzate tutte le pagine ed evitare i noindex, ecco perchè sto cercando di risolvere in questi modi.
Di nuovo, se dici ai motori di ricerca di non considerare gli URL di quelle pagine mandandoli alla home (concetto già sbagliato di per sé) è come se gli dicessi di non indicizzarli, e quindi quegli articoli non appariranno nei SERP. àˆ quello che vuoi? Devi saperlo tu.
Io posso solo dirti che è quello che otterresti.
Ripeto, se è questo che vuoi metti “no index” nelle sotto-pagine di TUTTI gli archivi e quelle pagine, insieme ai suoi titoli e alle sue descrizioni, non saranno più considerate e risolvi del tutto il “problema” alla base: ottieni la stessa cosa che hai chiesto con una semplice spunta.
I titoli e le descrizioni duplicate sono un risvolto comune nel momento in cui si definiscono titoli e descrizioni, non succede solo a te, e quello di aggiungere %%page%% è un altro metodo semplice se usi Yoast, che c’è di fastidioso? Funziona? Non lo so, prova, ma non sperare che le segnalazioni spariscano subito, sono le voci più lente di tutta la Console ad aggiornarsi.
Altrimenti, terzo metodo, non metti nulla e lasci che sia Google a pescare dove vuole, come di solito fa in tutte le cose che non definiamo (e a volte anche in quelle che definiamo), e in questo caso difficilmente saranno rilevati uguali dato che prenderà del testo a caso.
àˆ inutile modificare i plugin perché quando li aggiorni perdi le modifiche, e neppure saresti in grado. Semmai puoi creare filtri da inserire nel functions.php del child-theme usando le API del plugin: parli solo di home page (o addirittura di “modificare il codice SOLO della pagina 2 (o al massimo anche della pagina 3)” – ma che dici?), ma non è l’unica ad aver paginazione, tutte le pagine archivi a seconda di quanti contenuti hai hanno più o meno paginazione, tutte le tassonomie (tag, categorie) e archivi vari, se G non li ha ancora segnalati non significa che non ci sono o non ci saranno. Cosଠdovresti disabilitare del tutto il canonical, altra manovra anti-SEO.
Non so dove hai letto quei molti che suggeriscono il canonical come soluzione ai titoli e descrizioni duplicati, metti un link diretto e autorevole di almeno uno di quei tanti, o spiega tu il perché in modo chiaro.
E comunque questo non è un forum di SEO. Se vuoi andare a fondo, discutere la tua idea o cercarne altre scrivi in un forum di SEO e/o nel forum di Google e digli che non hai capito il Mistake 1 cosଠsanno subito di che stai parlando.
Preoccupati però prima di tutte quelle voci di menu che non portano a nulla, problema molto più importante dal punto di vista SEO ma soprattutto da quello dell’esperienza dell’utente.
-
2 Giugno 2016 alle 21:32 #120560WillSmith7Partecipante
Non è che scrivo a pezzi, è che per me è difficile spiegare non intendendomene del settore. Essendo che in molti forum la gente non risponde proprio quando vede complicazioni, ho preferito aspettare nel documentarmi per un’ora al fine di scrivere la spiegazione completa del mio problema per non perdere tempo inutilmente.
Mi hai detto di usare il forum di Google per la SEO, ma è proprio da lଠche vengo. E’ stato proprio una persona dello staff di quel forum, dopo aver controllato sul sito, a consigliarmi il canonical modificato come soluzione, ma di evitare il noindex. Mi è stato detto di cercare un plugin per modificare il canonical perchè questa persona non ne conosceva nemmeno uno (per evitare modifiche al php).
Tra l’altro, giusto una parentesi anche se magari non ti interessa per nulla, non immagini che storia… Sono stato mandato da questa persona dal forum sulla community di supporto per webmaster Google+, e lଠinvece di aiutarmi mi mandano PM per farmi consulenze a pagamento (ovviamente non è colpa sua, lui è stato gentilissimo).
Ho letto il link di Yoast ancora prima che me lo dessi tu, ma ho preferito restare su ciò che mi avevano detto sul forum per webmaster. Se ho sbagliato forum su cui chiedere aiuto allora pardon.
Per concludere tornando al problema, solo se ne hai voglia, ciò che vorrei fare è optare per %%pagenumber%%, ma resta solo una cosa da fare, la seguente. Il filtro da inserire in functions.php per rimuovere “Pagina 1” solo dal title della home, sempre se si può fare con un filtro, non so come crearlo, il link con le API non è abbastanza per me per capire come costruire questo codice…
-
3 Giugno 2016 alle 8:28 #120561TittiModeratore
Usa %%page%%, te l’ho già detto, non %%pagenumber%%, nel titolo del template, e non avrai il numero sulla prima pagina.
Forum Google: tltr. Non ti aspetterai davvero che legga tutta quella roba! O indichi con esattezza il punto esatto in cui ti dicono quelle parole, oppure niente.
In ogni caso non discuto comunque, non sono io a dirlo, ma Google a quel link che ti ho indicato sopra, Mistake 1. Passaglielo, se vuoi, se proprio ti hanno detto quello che sostieni.
Il no-index, lo ripeto nel caso ancora non l’avessi capito, te l’ho consigliato solo in rapporto e in sostituzione di quella cosa di non-indicizzazione con il canonical che volevi fare, perché otterresti lo stesso effetto senza andarti a impestare con il codice. Punto.
PS: non è questione di intendersene, ma di spiegarsi. Solo tu sai cos’hai in testa e quale sarebbe il tuo fine, noi non siamo qui per leggere nella mente.
Per non perdere tempo te, lo fai perdere a chi ti risponde, è giusto secondo te, quando il problema è tuo?
Se in tutti i forum fai sempre domande cosଠpoco circostanziate, è chiaro che nessuno ti risponde.
-
3 Giugno 2016 alle 13:42 #120564WillSmith7Partecipante
Grazie, credevo che avessi scritto page solo per abbreviare pagenumber (non conoscevo proprio il comando), comunicherò alla direzione del mio sito in questione. Comunque non l’ho fatto di proposito, per me è veramente difficile spiegare essendo un profano, e non era mia intenzione farti perdere tempo. Grazie ancora
-
3 Giugno 2016 alle 13:55 #120565TittiModeratore
Di niente. Quella cosa delle pagine non trovate la devi risolvere. Aggiorna i permalink in Impostazioni permalink, cliccando sul bottone Salva.
E disattiva e poi elimina qualsiasi altro plugin di SEO oltre a Yoast tu abbia per caso attivato nel tentativo di fare quello che volevi fare.
Edit: le variabili dei metadati le trovi cliccando su Help center.
-
-
AutorePost
- Devi essere connesso per rispondere a questo topic.