Help us understand the problem. What is going on with this article?

Laravel で画像サイトマップを作る

Laravelium/laravel-sitemapを使う

インストール方法は以下
https://github.com/Laravelium/laravel-sitemap

サンプル

add関数の第5引数が画像サイトマップ用の値。
公式には見当たらなかったのでメモ。

public function toXmlFile(){
  $sitemap = \App::make('sitemap');
  $sitemap->add(
    "http://sample.com/spot/1",  // page url
    "2021-01-12T00:00:00+00:00", // last modified
    0.6,                         // priority
    "yearly",                    // frequency
    [                            // 画像サイトマップの設定
      [
       'url' => "http://sample.com/spot/1.jpg",
       'title' => "サンプルタイトル",
       'caption' => "このサンプルは日本語",
       'geo_location' => "東京都、新宿区",
       'license' => "http://sample.com"
      ]
    ]
  );
}

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away