Skip to content

Commit

Permalink
Favicon image setting
Browse files Browse the repository at this point in the history
  • Loading branch information
danpros committed Mar 13, 2024
1 parent c445c6c commit bb5916e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions config/config.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ default.title.format = "%page_title% - %blog_title%"
; Default image for Open Graph
default.image = ""

; Favicon image
favicon.image = ""

; Set the theme here
views.root = "themes/twentysixteen"

Expand Down
8 changes: 7 additions & 1 deletion system/admin/views/config-metatags.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,16 @@
<br><br>
<form method="POST">
<input type="hidden" name="csrf_token" value="<?php echo get_csrf(); ?>">
<div class="form-group row">
<label for="favicon.image" class="col-sm-2 col-form-label">Favicon Image</label>
<div class="col-sm-10">
<input type="text" name="-config-favicon.image" class="form-control" id="favicon.image" value="<?php echo config('favicon.image');?>" placeholder="<?php echo site_url();?>favicon.png">
</div>
</div>
<div class="form-group row">
<label for="default.image" class="col-sm-2 col-form-label"><?php echo i18n('default');?> Image</label>
<div class="col-sm-10">
<input type="text" name="-config-default.image" class="form-control" id="default.image" value="<?php echo config('default.image');?>" placeholder="<?php echo site_url();?>resources/images/logo-big.png">
<input type="text" name="-config-default.image" class="form-control" id="default.image" value="<?php echo config('default.image');?>" placeholder="<?php echo site_url();?>system/resources/images/logo-big.png">
</div>
</div>
<br>
Expand Down
8 changes: 7 additions & 1 deletion system/includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3421,12 +3421,18 @@ function head_contents()
$output = '';
$wmt_id = config('google.wmt.id');
$version = 'HTMLy ' . constant('HTMLY_VERSION');
$favicon = config('favicon.image');
if (empty($favicon)) {
$favicon = '<link rel="icon" type="image/x-icon" href="' . site_url() . 'favicon.ico" />' . "\n";
} else {
$favicon = '<link rel="icon" type="image/'. pathinfo($favicon, PATHINFO_EXTENSION) .'" href="' . $favicon . '" />' . "\n";
}

$output .= '<meta charset="utf-8" />' . "\n";
$output .= '<meta http-equiv="X-UA-Compatible" content="IE=edge" />' . "\n";
$output .= '<meta name="viewport" content="width=device-width, initial-scale=1" />' . "\n";
$output .= '<meta name="generator" content="' . $version . '" />' . "\n";
$output .= '<link rel="icon" type="image/x-icon" href="' . site_url() . 'favicon.ico" />' . "\n";
$output .= $favicon;
$output .= '<link rel="sitemap" href="' . site_url() . 'sitemap.xml" />' . "\n";
$output .= '<link rel="alternate" type="application/rss+xml" title="' . blog_title() . ' Feed" href="' . site_url() . 'feed/rss" />' . "\n";
if (!empty($wmt_id)) {
Expand Down

0 comments on commit bb5916e

Please sign in to comment.