Skip to content

Commit

Permalink
removed language from blog
Browse files Browse the repository at this point in the history
  • Loading branch information
Combind committed Mar 17, 2023
1 parent 494a1bf commit 2df6952
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/HygraphApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ public function redirects(): array

public function posts(?string $lang = null): array|Collection|null
{
return Cache::remember($lang ?? $this->lang.'_'.'allPosts', $this->ttl, function () {
return Cache::remember('allPosts', $this->ttl, function () {
$gql = (new Query('posts'))
->setArguments(['locales' => new RawObject($lang ?? $this->lang), 'orderBy' => new RawObject('publicationDate_DESC')])
->setArguments(['orderBy' => new RawObject('publicationDate_DESC')])
->setSelectionSet(
[
'id',
Expand All @@ -179,9 +179,9 @@ public function posts(?string $lang = null): array|Collection|null

public function categories(): array|null
{
return Cache::remember($this->lang.'_'.'allPostCategories', $this->ttl, function () {
return Cache::remember('allPostCategories', $this->ttl, function () {
$gql = (new Query('categories'))
->setArguments(['locales' => new RawObject($this->lang), 'orderBy' => new RawObject('name_ASC')])
->setArguments(['orderBy' => new RawObject('name_ASC')])
->setSelectionSet(['id', 'name', 'slug']);

return $this->query($gql)->categories;
Expand All @@ -190,9 +190,9 @@ public function categories(): array|null

public function article(string $slug): object|null
{
return Cache::remember($this->lang.'_'.'article_'.$slug, $this->ttl, function () use ($slug) {
return Cache::remember('article_'.$slug, $this->ttl, function () use ($slug) {
$gql = (new Query('post'))
->setArguments(['locales' => new RawObject($this->lang), 'where' => new RawObject('{slug: "'.$slug.'"}')])
->setArguments(['where' => new RawObject('{slug: "'.$slug.'"}')])
->setSelectionSet(
[
'id',
Expand Down Expand Up @@ -240,9 +240,9 @@ public function article(string $slug): object|null

public function featuredPosts(): array|null
{
return Cache::remember($this->lang.'_'.'featuredPosts', $this->ttl, function () {
return Cache::remember('featuredPosts', $this->ttl, function () {
$gql = (new Query('posts'))
->setArguments(['locales' => new RawObject($this->lang), 'where' => new RawObject('{isFeatured: true}'), 'orderBy' => new RawObject('publicationDate_DESC')])
->setArguments(['where' => new RawObject('{isFeatured: true}'), 'orderBy' => new RawObject('publicationDate_DESC')])
->setSelectionSet(
[
'id',
Expand All @@ -263,7 +263,7 @@ public function featuredPosts(): array|null
public function relatedPosts(array $ids): array|null
{
$gql = (new Query('posts'))
->setArguments(['locales' => new RawObject($this->lang), 'where' => new RawObject('{id_in: ["'.implode('","', $ids).'"]}')])
->setArguments(['where' => new RawObject('{id_in: ["'.implode('","', $ids).'"]}')])
->setSelectionSet(
[
'id',
Expand Down
3 changes: 1 addition & 2 deletions src/SeoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public function page(array $page): void
SEOTools::addImages([$page['seo_image']]);
}

SEOTools::setTitle($page['meta_title'])
->setDescription($page['meta_description']);
SEOTools::setTitle($page['meta_title'])->setDescription($page['meta_description']);

OpenGraph::addProperty('local', app()->getLocale());

Expand Down

0 comments on commit 2df6952

Please sign in to comment.