Skip to content

Commit

Permalink
Merge pull request #1 from Paradem/seo_tags
Browse files Browse the repository at this point in the history
Always fetching SEO tags
  • Loading branch information
psguazz authored Mar 8, 2024
2 parents 3374d82 + bb39391 commit d0a189d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/dato_cms_graphql/graphql_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ def query_for
<<~GRAPHQL
#{locale}_items: all#{plural_name}(locale: #{locale}, fallbackLocales: [#{I18n.default_locale}], first: #{graphql_page_size}, skip: $skip) {
#{fields}
_seoMetaTags {
tag
content
attributes
}
}
GRAPHQL
end
Expand All @@ -76,6 +82,12 @@ def query_for_single
<<~GRAPHQL
#{locale}_item: #{single_name}(locale: #{locale}, fallbackLocales: [#{I18n.default_locale}]) {
#{fields}
_seoMetaTags {
tag
content
attributes
}
}
GRAPHQL
end
Expand Down
10 changes: 9 additions & 1 deletion lib/test_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ def self.coerce_result(value, ctx)
end
end

class TagType < GraphQL::Schema::Object
field :tag, String, null: true
field :content, String, null: true
field :attributes, String, null: true
end

class PersonType < GraphQL::Schema::Object
field :id, String, null: true
field :name, String, null: true
field :_seo_meta_tags, [TagType], null: false
end

class MetaType < GraphQL::Schema::Object
Expand Down Expand Up @@ -42,7 +49,8 @@ def _all_under_tests_meta
def all_under_tests
OpenStruct.new(
id: "test",
name: "Stan"
name: "Stan",
_seo_meta_tags: []
)
end
end
Expand Down

0 comments on commit d0a189d

Please sign in to comment.