|
6 | 6 | xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd" |
7 | 7 | title="Sitemap" id="receipt-sitemap" help-id="sitemap"> |
8 | 8 |
|
9 | | - <link-summary>Recipe for creating a sitemap</link-summary> |
10 | | - <card-summary>Recipe for creating a sitemap</card-summary> |
11 | | - <web-summary>Recipe for creating a sitemap</web-summary> |
| 9 | + <link-summary>How to create a sitemap feed</link-summary> |
| 10 | + <card-summary>Step-by-step recipe for creating a sitemap</card-summary> |
| 11 | + <web-summary>Step-by-step guide to creating a sitemap feed</web-summary> |
12 | 12 |
|
13 | 13 | <show-structure depth="3" /> |
14 | 14 |
|
| 15 | + <p> |
| 16 | + This recipe walks you through creating a product sitemap feed using Laravel Feeds. You will generate the |
| 17 | + necessary classes, implement the feed logic, expose the files via the filesystem, and reference the sitemap |
| 18 | + from a root sitemap.xml if needed. |
| 19 | + </p> |
| 20 | + |
15 | 21 | <chapter title="Create files" id="create_files"> |
| 22 | + <p> |
| 23 | + Generate the feed and its item class using the console command: |
| 24 | + </p> |
16 | 25 | <code-block lang="bash"> |
17 | 26 | %command-make-simple% Sitemaps/Product -%command-shortcut-item% |
18 | 27 | </code-block> |
19 | 28 | </chapter> |
20 | 29 |
|
21 | | - <chapter title="Filling the feed" id="filling_the_feed"> |
| 30 | + <chapter title="Fill the feed" id="filling_the_feed"> |
| 31 | + <p> |
| 32 | + Implement the feed root element, attributes, query builder, filename, and item mapping as shown below: |
| 33 | + </p> |
22 | 34 | <code-block lang="php" src="receipt-sitemap-feed.php" /> |
23 | 35 | </chapter> |
24 | 36 |
|
25 | | - <chapter title="Filling the feed item" id="filling_the_feed_item"> |
| 37 | + <chapter title="Fill the feed item" id="filling_the_feed_item"> |
| 38 | + <p> |
| 39 | + Define the XML element name and map model properties to sitemap tags: |
| 40 | + </p> |
26 | 41 | <code-block lang="php" src="receipt-sitemap-feed-item.php" /> |
27 | 42 | </chapter> |
28 | 43 |
|
|
32 | 47 |
|
33 | 48 | <chapter title="Links" id="links"> |
34 | 49 | <p> |
35 | | - Don't forget to add a link to the folder with site maps in the |
| 50 | + Add a filesystem link to the directory containing your sitemaps in the |
36 | 51 | <a href="https://github.com/laravel/laravel/blob/12.x/config/filesystems.php#L76-L78">config/filesystems.php</a> configuration file: |
37 | 52 | </p> |
38 | 53 |
|
39 | 54 | <code-block lang="php" src="receipt-sitemap-links.php" include-lines="5-" /> |
40 | 55 |
|
41 | 56 | <p> |
42 | | - After that, run the console command: |
| 57 | + Then create the public symlink so the files are accessible via the browser: |
43 | 58 | </p> |
44 | 59 |
|
45 | 60 | <code-block lang="bash"> |
|
51 | 66 | <include from="snippet-generate.topic" element-id="feed_generate" /> |
52 | 67 | </chapter> |
53 | 68 |
|
54 | | - <chapter title="Adding a link to the general sitemap.xml file" id="adding_a_link_to_the_general_sitemap_xml_file"> |
| 69 | + <chapter title="Add a link to the root sitemap.xml" id="adding_a_link_to_the_general_sitemap_xml_file"> |
| 70 | + <p> |
| 71 | + If you maintain a root sitemap.xml file that references other sitemaps, add an entry like this: |
| 72 | + </p> |
55 | 73 | <code-block lang="xml" src="receipt-sitemap-root.xml" /> |
56 | 74 | </chapter> |
57 | 75 |
|
58 | 76 | <chapter title="Result" id="result"> |
| 77 | + <p> |
| 78 | + A generated sitemap.xml for your products will look like this: |
| 79 | + </p> |
59 | 80 | <code-block lang="xml" src="receipt-sitemap-feed.xml" /> |
60 | 81 | </chapter> |
61 | 82 |
|
|
0 commit comments