diff --git a/app/models/layout.rb b/app/models/layout.rb index 2d68273a..c70829fa 100644 --- a/app/models/layout.rb +++ b/app/models/layout.rb @@ -28,6 +28,11 @@ Layout = Struct.new(:site, :name, :meta, :metadata, keyword_init: true) do meta[:hidden].present? end + # Detecta si el layout no es renderizable + def ignored? + @ignored ||= site.config['ignored_layouts']&.include? name.to_s + end + # Los metadatos del Layout. # # TODO: Inicializar con valores por defecto o usar Hash#default_proc diff --git a/app/views/posts/show.haml b/app/views/posts/show.haml index c6bd1d8e..9dd4faa0 100644 --- a/app/views/posts/show.haml +++ b/app/views/posts/show.haml @@ -12,12 +12,12 @@ edit_site_post_path(@site, @post.id), class: 'btn btn-block' - = link_to t('posts.preview.btn'), - site_post_preview_path(@site, @post.id), - class: 'btn btn-block', - target: '_blank', - rel: 'noopener' - .alert.alert-info= t('posts.preview.alert') + - unless @post.layout.ignored? + = link_to t('posts.preview.btn'), + site_post_preview_path(@site, @post.id), + class: 'btn btn-block', + target: '_blank', + rel: 'noopener' %table.table.table-condensed %thead