Czy chcesz dodać spis treści do twoich wpisów lub stron WordPress?
Spis treści (TOC) może ułatwić nawigację po długim artykule i poprawić SEO twojej witryny WordPress. Jednak ich tworzenie może być trudne dla początkujących.
W tym artykule pokażemy, jak utworzyć spis treści w wpisach i na stronach WordPress.
Dlaczego warto dodawać spis treści do wpisów i stron w WordPressie?
Być może widziałeś spis treści na witrynach internetowych takich jak Wikipedia. Używamy ich również na WPBeginner do naszych długich artykułów, takich jak nasz ostateczny przewodnik po zwiększeniu szybkości i wydajności WordPressa.
Możesz dodać spis treści do wpisów na twojej witrynie internetowej WordPress, aby ułatwić przeskakiwanie między sekcjami długiego artykułu.
Nie tylko poprawiają one komfort użytkowania, ale także pomagają Twojemu WordPress SEO. Dzieje się tak, ponieważ Google może używać spisu treści do automatycznego dodawania odnośników „przejdź do sekcji” w wynikach wyszukiwania.
Spis treści może również pomóc w wyświetleniu twojego wpisu jako fragmentu kodu na górze strony wyników wyszukiwania.
Pomoże to uzyskać maksymalny ruch SEO.
Mając to na uwadze, przyjrzyjmy się, jak łatwo utworzyć spis treści w wpisach i stronach WordPress. Pokażemy, jak zrobić to automatycznie za pomocą wtyczki i ręcznie za pomocą odnośników kotwic:
Metoda 1: Automatyczne dodawanie spisu treści w WordPressie
AIOSEO, znane również jako All in One SEO, jest najlepszą wtyczką WordPress SEO i posiada wbudowany blok spisu treści dla WordPress.
Zalecamy tę metodę, ponieważ pozwala ona zaoszczędzić czas dzięki automatycznemu generowaniu spisu treści na podstawie twoich podtytułów, a jednocześnie umożliwia jego pełne dostosowanie za pomocą edytowalnych odnośników.
Aby uzyskać więcej informacji, zobacz naszą pełną recenzję AIOSEO.
Pierwszą rzeczą, którą musisz zrobić, to zainstalować darmową wtyczkę All in One SEO Lite. Aby uzyskać więcej informacji, zapoznaj się z naszym przewodnikiem krok po kroku, jak zainstalować wtyczkę WordPress.
Wystarczy darmowa wersja, aby łatwo dodać spis treści, ale AIOSEO Pro oferuje jeszcze więcej funkcji, które pomogą Ci uzyskać lepszą pozycję na stronach wyników wyszukiwania.
Po włączaniu należy skonfigurować wtyczkę za pomocą kreatora konfiguracji AIOSEO. Szczegółowe instrukcje można znaleźć w naszym przewodniku na temat prawidłowej konfiguracji All in One SEO dla WordPress.
Dodawanie spisu treści za pomocą All in One SEO
Musisz utworzyć lub edytować wpis lub stronę, na której chcesz dodać spis treści. Następnie kliknij niebieską ikonkę „+” w edytorze bloków i znajdź blok „AIOSEO – Spis treści”.
Wystarczy przeciągnąć blok na wpis lub stronę, na której ma pojawić się spis treści.
Uwaga: Po dodaniu spisu treści możesz powiadomić, że blok „AIOSEO – Spis treści” będzie wyszarzony. Wynika to z faktu, że na wpis lub stronę można dodać tylko jeden spis treści.
Wtyczka automatycznie zidentyfikuje nagłówki na stronie i doda je do twojego spisu treści. Jeśli użyjesz różnych poziomów nagłówków (powiedzmy H2 i H3), nagłówki niższego poziomu zostaną wcięte, aby pokazać strukturę twojej treści.
Jeśli nadal piszesz treść swojego wpisu lub strony, to wszelkie nagłówki dodane do dokumentu zostaną automatycznie dodane do spisu treści.
Konfigurator spisu treści z All in One SEO
Istnieje kilka sposobów na dostosowanie spisu treści do twoich potrzeb. Można na przykład kliknąć nagłówek, aby zmienić jego nazwę. Spowoduje to zmianę nazwy nagłówka w spisie treści, ale nie artykułu.
AIOSEO automatycznie utworzy odnośniki kotwicy dla każdego nagłówka. Możesz kliknąć ikonkę odnośnika, aby edytować tekst kotwicy, który zostanie zmieniony zarówno w spisie treści, jak i w nagłówku w treści wpisu.
Można również kliknąć ikonkę oka obok dowolnego nagłówka, aby go ukryć. Użytkownicy AIOSEO Pro mogą zmieniać kolejność nagłówków w bloku spisu treści. Spowoduje to zmianę kolejności nagłówków w spisie treści, ale nie w artykule.
Na pasku bocznym znajduje się również ustawienie bloku. Tutaj możesz wybrać styl listy wypunktowanej lub numerowanej dla twojego spisu treści.
Na koniec, po zakończeniu konfiguratora twojego spisu treści WordPress, musisz kliknąć przycisk „Gotowe”, aby zapisać zmiany.
Teraz będziesz mógł zobaczyć, jak spis treści będzie wyglądał dla twoich odwiedzających.
Dobrym pomysłem jest dodanie nagłówka lub akapitu nad spisem treści. Dzięki temu czytelnicy będą wiedzieć, że oglądają spis treści.
Gdy odwiedzający twoją stronę klikną odnośnik w spisie treści, zostaną natychmiast przeniesieni do tego nagłówka w artykule. Pozwala to użytkownikom przejść do sekcji, którą są najbardziej zainteresowani.
Powodem, dla którego lubimy funkcję spisu treści AIOSEO, jest to, że pozwala ona dostosować nagłówki i selektywnie ukrywać nagłówki w razie potrzeby.
Jest to krytyczna funkcja, której większość innych wtyczek do spisu treści po prostu nie ma.
Metoda 2: Ręczne dodawanie spisu treści w WordPressie
Spis treści można również utworzyć ręcznie za pomocą odnośników kotwic bez konieczności korzystania z wtyczki. Wymaga to jednak więcej czasu i wysiłku.
Więcej o anchor linkach dowiesz się z naszego przewodnika na temat dodawania anchor linków w WordPressie.
Rodzaj spisu treści
Najpierw należy dodać blok „Lista”, w którym można dodać nagłówki spisu treści. Możesz wpisać nagłówki do listy lub skopiować je i wkleić jeden po drugim z treści twojego artykułu.
Jak dodać tekst kotwicy do bloków nagłówków?
Następnie musisz dodać atrybut kotwicy do każdego nagłówka, do którego chcesz się odwołać w spisie treści. Dzięki temu WordPress będzie wiedział, gdzie przeskoczyć, gdy odwiedzający kliknie nagłówek w spisie treści.
Najpierw należy kliknąć nagłówek, taki jak H2 lub H3. Następnie należy kliknąć strzałkę „Zaawansowane” w panelu ustawień bloku, aby wyświetlić ustawienia zaawansowane.
Następnie wpisz unikatowe słowo lub frazę bez spacji w polu „Kotwica HTML”. Jeśli chcesz, możesz użyć myślników do oddzielenia każdego słowa.
Następnie powtórz tę czynność dla wszystkich innych nagłówków, które zostaną dołączone do spisu treści.
Wskazówka: Jeśli wkleisz nagłówek do tego pola, myślniki zostaną dodane automatycznie. Jest to łatwy sposób na utworzenie unikatowego identyfikatora, który jednocześnie wyraźnie reprezentuje nagłówek.
Dodawanie odnośników kotwic do spisu treści
Ostatnim krokiem jest powiązanie nagłówków w spisie treści z utworzonymi kotwicami HTML.
Powinieneś podświetlić pierwszy wpis na twojej liście zablokowanych, a następnie kliknąć ikonkę „odnośnika” na pasku narzędzi.
Następnie należy wpisać hashtag (#), a następnie wpisać lub wkleić tekst kotwicy dla tego nagłówka.
Znak # mówi WordPressowi, aby przeskoczył do tej sekcji obecnego, aktualnego wpisu. Nie dodajesz nazwy domeny ani innych parametrów adresu URL.
Gdy to zrobisz, musisz nacisnąć „Wpisz” lub kliknąć ikonkę „Prześlij”, aby utworzyć odnośnik.
Kotwica odnośnika zostanie dodana do twojego spisu treści. Gdy odwiedzający klikną ten odnośnik, zostaną natychmiast przeniesieni do danego wpisu lub treści strony.
Możesz powtórzyć te kroki, aby dodać odnośniki kotwic do innych nagłówków w spisie treści.
Mamy nadzieję, że ten poradnik pomógł ci dowiedzieć się, jak utworzyć spis treści w wpisach i stronach WordPress. Możesz również zapoznać się z naszym przewodnikiem na temat tego, jak zwiększyć ruch na blogu lub z naszą ekspercką listą niezbędnych wtyczek WordPress do rozwoju twojej witryny.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Sam Smith says
I am in word press post editor and I do not see the blue plus button or the advanced block. How do I see those features?
WPBeginner Support says
If you re using the block editor then you may want to try disabling distraction free editing in the top-right and that should allow you to see the plus again.
Administrator
Ahmed Omar says
I am already using the first method, and it help my site to appear first in some search results and of course bringing more visitors
Thank you
WPBeginner Support says
You’re welcome!
Administrator
Thank you so much says
Can you please tell how to change the font color in TOC?
WPBeginner Support says
For that, you would need to use CSS to change the color of the text. You can see how to change the text color in our article below!
https://www.wpbeginner.com/wp-tutorials/how-to-change-the-text-color-in-wordpress-easy-methods/
Administrator
ario says
I tried to create table of content manually like the way you taught us and it worked well, until I added page break and separated the points into different parts or pages. Is there a solution for this?
WPBeginner Support says
If you separate the page then you would need to include the entire URL before the # as well as the anchor to link correctly.
Administrator
Mark says
Back in the day, when websites were new, we used to call this a Site Map. But yeah, it was kind of expected for the search engines to find a site map on your website.
Thanks for the reminder and the info.
WPBeginner Support says
Sitemaps are slightly different, we have our guide below for sitemaps specifically. The Table of contents is to allow your visitors to jump to a specific section of a post
https://www.wpbeginner.com/beginners-guide/what-is-a-wordpress-sitemap-how-to-create-a-sitemap-in-wordpress/
Administrator
samarth says
Which one is better for SEO? Adding TOC manually by HTML or using a Plugin?
WPBeginner Support says
If the information added is the same, then there is no difference. The plugin is there to help make the process easier and help ensure any markup is properly added.
Administrator
Tay says
How can I manually place the TOC on specific pages? It seems I can only disable auto-insertion but I can’t then decide where I want to put the table on the page. Is this possible?
WPBeginner Support says
The table of contents would need to be enabled for pages and then there should be an option when editing the specific page you want to add it to.
Administrator
Muhammad Arslan Sharif says
What a tutorial and very helpful for me and other who want to add new features in their websites and in blogs. In very short words you explain exceptionally.
WPBeginner Support says
Glad you found our guide helpful
Administrator
Rianne says
Brilliant! What I thought would take me hours took me 20 minutes instead
WPBeginner Support says
Glad our guide was helpful
Administrator
Claudia says
Thank you for all your helpful articles!
WPBeginner Support says
You’re welcome
Administrator
Kim Balchios says
My developer created a Table of Contents on a really long blog I wrote. I edited one of the entries and the link fell off.
When I try to create a new entry it says „Paste URL or type to search.” If I add the URL, it will take the reader to the top of the blog not the exact place inside the blog.
WPBeginner Support says
You would want to create an anchor link following our guide below:
https://www.wpbeginner.com/beginners-guide/how-to-easily-add-anchor-links-in-wordpress-step-by-step/
Administrator
David Ellin says
this video shows me how to create a table of contents within a post. I want to create a table of contents for my entire blog so that the title of each article appears in the TOC. How do I do that?
WPBeginner Support says
You would want to take a look at our article below for how to create a blog page as a ToC would get far too long for what you’re wanting to do.
https://www.wpbeginner.com/wp-tutorials/how-to-create-a-separate-page-for-blog-posts-in-wordpress/
Administrator
jean says
Hi thank you for this informative post!
Only a small question, what is „override the global settings for this specific post / page.”
I chose to insert the table of content manually, and when i check only for h2 & h3, the table of content just doesn’t show up at all.
Thank you!
WPBeginner Support says
That would mean you are telling it to ignore your default settings for the plugin for that specific post/page. If you have no H2 or H3s on the page then there wouldn’t be anything for the plugin to add to the table.
Administrator
Ahmad Zeeshan says
In setting there is no „Table of Content”. Where to find it?
WPBeginner Support says
You would want to ensure you activated the plugin after installing it.
Administrator
Dheeraj soni says
Thanks for sharing an informative article, your content always helps me to go next level.
WPBeginner Support says
You’re welcome, glad you found our content helpful
Administrator
Asthen says
Why wpbeginner don’t recommend using TOC unless it’s really long ?
How long is too long ?
WPBeginner Support says
If the page is too short to scroll then there wouldn’t be a reason to have a table of contents. It is a personal preference for the length of a post.
Administrator
SAHIL DHIMAAN says
Hi, very helpful article
But….
Table of content isn’t showing in Mobile, what to do…
i use AMP plugin also…
WPBeginner Support says
Your AMP plugin would be removing the plugin’s additions. If you reach out to the table of contents plugin’s support they can let you know if they have AMP support.
Administrator
Bee Lian Low says
Thank you, I have waited so long before I decided to install this Table Of ontent!
WPBeginner Support says
You’re welcome
Administrator
Cecilia says
Thanks. Easy to use.
WPBeginner Support says
You’re welcome
Administrator
Lucimar says
Good afternoon!
Congratulations on the article, it helped me a lot
However, it just didn’t work on amp pages.
Note: I use the „Accelerated Mobile Pages” plugin.
How can I solve?
Thank you!
WPBeginner Support says
You would want to reach out to the plugin’s support for if there is a recommendation for AMP.
Administrator
Džangir Kolar says
Hi!
How those this plugin affect the speed of the page itself?
WPBeginner Support says
It shouldn’t affect your page’s speed.
Administrator
Luke Richardson says
Using easy table of contents, is there an option to create hyperlinks to jump to that particular section when you click on one of the headings in the table.
Not sure if I’m missing something with the plugin, but when I click on the headings it doesn’t jump to that section at all.
thanks
WPBeginner Support says
The plugin should be allowing that, you may want to ensure there is enough room between your content and you don’t have any browser addons that would prevent scrolling to a certain section of your page.
Administrator
Tosh Lubek says
I’ve checked „Initially hide the table of contents” but the TOC shows every time I open a post with a TOC. Is there something else I need to do?
WPBeginner Support says
You would want to reach out to the plugin’s support to ensure this is not a conflict between the plugin and your theme
Administrator
Oulimata says
As usual, amazingly detailed and helpful. You guys have definitely become my go-to resource for anything blogging related.
WPBeginner Support says
Thank you, glad we can continue to be helpful
Administrator
Raaz shrestha says
The plugin is really great. Thanks for sharing wpbeginner team.
WPBeginner Support says
Glad you liked our recommendation
Administrator
Akamps says
Hey is there a way i can put this table of contents in my sidebar
WPBeginner Support says
The plugin does have a widget you can use
Administrator
Nic says
Is there anyway to centre the table?
WPBeginner Support says
You would need to enable custom CSS and depending on your theme would determine the CSS needed
Administrator
KM says
How use the plugin “manually” just one lost at a time? Instructions not clear
WPBeginner Support says
You would enable support for the post type you want to have the table of contents in and when you edit one of the types where it is activated, it will have the option at the bottom of the editor to add the table of contents
Administrator
Kelvin says
NO it’s POSTS again – not pages!
How do I get a table into a page?
WPBeginner Support says
In the plugin’s settings you would enable support for pages and you should be able to follow the same procedure for pages that you do for posts.
Administrator
Rishi says
nice
WPBeginner Support says
Glad you like our article
Administrator
Abhishek says
Hi, is this possible to show/hide individual headings, just by clicking on it, like on Wikipedia?
I have too many subheadings under each h3 so I want it to be easier to navigate.
WPBeginner Support says
Hi Abhishek,
Please see our article on how to show hide text in WordPress using toggle effect.
Administrator
Alex says
Thanks for article!
Prince Gabriel Okocha says
I have installed this plugin on my blog following the guideline in this post. But it’s not showing up on my posts. Is there anything I’m doing wrong? I really need this to ASAP
WPBeginner Support says
Hello,
Please review plugin settings, you need to enable support for the posts and pages. After that edit the post and page and below the post editor you will find TOC settings. From here, you need to check the box 'Insert table of contents’ to add it in that particular post.
Administrator
Srinu says
Thanks for the article it’s working for me, But I am getting with bullets and numbers, in TOC_Box how to change it. I already numbered with h2 tags.
so its repeated the numbers twice.
Mae says
Thank you so much! I used this for my Exclusives Library and I love it! Now my subscribers won’t have a difficult time looking for their printables.
XOXO,
Mae
Jan Peter Aursnes says
A fine plugin, but is there any way I can exclude pages? Writing in headings and using * and ⎮ does not work, for me anyway. I am not a tech guy so it could be I just need a bit of explanation.
Thanks in advance.
Raushan says
This is best plugin but when i created table of content from this plugin then showing multiple H1 tag which is not good at seo point of view.
How to solve this ?
Thanks
Sunil Suresh says
Thanks. Your article came at the right time for me! I was just now looking for something like this for a client of mine.