Skip to content

Commit b482bc6

Browse files
authored
Allow different feeds on the same site (& page) (#2)
2 parents 423f309 + 279d2e3 commit b482bc6

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/ServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function bootAddon()
1818

1919
if ($this->app->runningInConsole()) {
2020
$this->publishes([
21-
__DIR__ . '/../config/statamic-instagram.php' => config_path('statamic-instagram.php'),
21+
__DIR__.'/../config/statamic-instagram.php' => config_path('statamic-instagram.php'),
2222
], 'statamic-instagram-config');
2323
}
2424

src/Tags/Instagram.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,19 @@ class Instagram extends Tags
2020
public function index()
2121
{
2222
$limit = $this->params->int('limit', 12);
23+
$profileHandle = $this->params->get('profile');
2324

24-
$cache_key = config('statamic-instagram.cache.key_prefix').'_'.$limit;
25+
$cache_key = config('statamic-instagram.cache.key_prefix').'_'.$profileHandle.'_'.$limit;
2526

26-
if (! $profileHandle = $this->params->get('profile')) {
27+
if (! $profileHandle) {
2728
return [];
2829
}
2930

3031
try {
3132
return $this->output(Cache::remember(
3233
$cache_key,
3334
now()->addSeconds(config('statamic-instagram.cache.duration')),
34-
fn() => $this->getData($profileHandle, $limit)
35+
fn () => $this->getData($profileHandle, $limit)
3536
));
3637
} catch (\Exception $exception) {
3738
Log::alert('Instagram error : '.$exception->getMessage());
@@ -74,7 +75,7 @@ private function getMedia(Profile $profile, $limit = 12): array
7475
$profile = app(Api::class)->getMoreMedias($profile);
7576

7677
$media = array_merge($media, $profile->getMedias());
77-
} while (count ($media) < $limit && $profile->hasMoreMedias());
78+
} while (count($media) < $limit && $profile->hasMoreMedias());
7879

7980
return collect($media)
8081
->take($limit)
@@ -83,7 +84,7 @@ private function getMedia(Profile $profile, $limit = 12): array
8384
$media['date'] = Carbon::parse($media['date']);
8485

8586
if ($media['video']) {
86-
$mediaClass = new Media();
87+
$mediaClass = new Media;
8788
$mediaClass->setLink($media['link']);
8889

8990
$media['videoUrl'] = app(Api::class)->getMediaDetailed($mediaClass)?->getVideoUrl();

0 commit comments

Comments
 (0)