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