HTMLを綺麗に

This commit is contained in:
2025-11-08 18:12:08 +09:00
parent adaf7622ae
commit 8513c530f5
7 changed files with 114 additions and 103 deletions

View File

@@ -42,7 +42,7 @@ class Template {
*/ */
public function addCss(string $name): void { public function addCss(string $name): void {
$this->custCss[] = $this->custCss[] =
'<link rel="stylesheet" type="text/css" href="/static/style-'.$name.'.css" />'; "<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/style-{$name}.css\" />\n";
$this->assign('custCss', $this->custCss); $this->assign('custCss', $this->custCss);
} }

View File

@@ -1,4 +1,6 @@
{@ include(common/header) @} {@ include(common/header) @}
{@ include(common/search) @}
<div class="news-article"> <div class="news-article">
{@ if (isset($meta->thumbnail) && $meta->thumbnail != '') @} {@ if (isset($meta->thumbnail) && $meta->thumbnail != '') @}
<div class="thumbnail{{ isset($meta->thumborient) && $meta->thumborient != 'center' ? ' '.$meta->thumborient : '' }}"> <div class="thumbnail{{ isset($meta->thumborient) && $meta->thumborient != 'center' ? ' '.$meta->thumborient : '' }}">
@@ -8,9 +10,18 @@
<div class="meta"> <div class="meta">
<div class="meta-date">{{ $meta->date }}</div> <div class="meta-date">{{ $meta->date }}</div>
<div class="meta-author">{{ $meta->author }}</div> <div class="meta-author">{{ $meta->author }}</div>
{@ if (isset($meta->category) && !empty($meta->category) && $meta->category[0] !== '') @}
{@ foreach ($meta->category as $cat) @}
<div class="meta-category">
{{ $cat }}
</div>
{@ endforeach @}
{@ endif @}
</div> </div>
<h1 class="title">{{{ $meta->title }}}</h1> <h1 class="title">{{{ $meta->title }}}</h1>
{{{ $article }}} {{{ $article }}}
</div> </div>
{@ include(common/footer) @} {@ include(common/footer) @}

View File

@@ -9,11 +9,9 @@
<div class="news-content"> <div class="news-content">
<div class="news-meta"> <div class="news-meta">
<span class="news-date">{{ $post['date'] }}</span> <span class="news-date">{{ $post['date'] }}</span>
{# {@ if (isset($post['category']) && is_array($post['category'])) @} #}
{@ foreach ($post['category'] as $cat) @} {@ foreach ($post['category'] as $cat) @}
<span class="news-category">{{ $cat }}</span> <span class="news-category">{{ $cat }}</span>
{@ endforeach @} {@ endforeach @}
{# {@ endif @} #}
</div> </div>
<h2 class="news-title"> <h2 class="news-title">
<a href="/{{ $section }}/{{ $post['slug'] }}{{{ isset($_GET['q']) ? '?q='.urlencode($_GET['q']) : '' }}}">{{{ $post['title'] }}}</a> <a href="/{{ $section }}/{{ $post['slug'] }}{{{ isset($_GET['q']) ? '?q='.urlencode($_GET['q']) : '' }}}">{{{ $post['title'] }}}</a>

View File

@@ -1,9 +1,11 @@
{@ include(common/header) @} {@ include(common/header) @}
{@ include(common/search) @} {@ include(common/search) @}
<div class="news-grid"> <div class="news-grid">
{@ foreach ($posts as $post) @} {@ foreach ($posts as $post) @}
{@ include(common/newscard) @} {@ include(common/newscard) @}
{@ endforeach @} {@ endforeach @}
</div> </div>
{@ include(common/pagination) @} {@ include(common/pagination) @}
{@ include(common/footer) @} {@ include(common/footer) @}