go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/projects/blogctl/pkg/constants/constants.go (about)

     1  /*
     2  
     3  Copyright (c) 2023 - Present. Will Charczuk. All rights reserved.
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository.
     5  
     6  */
     7  
     8  package constants
     9  
    10  const (
    11  	// DefaultConfigPath is the default config file name.
    12  	DefaultConfigPath = "./config.yml"
    13  	// DefaultOutputPath is the default output path.
    14  	DefaultOutputPath = "./dist"
    15  	// DefaultPostsPath is the default source path for post images.
    16  	DefaultPostsPath = "./posts"
    17  	// DefaultStaticsPath is the default source path static files.
    18  	DefaultStaticsPath = "./static"
    19  	// DefaultLayoutPath is the default layout path.
    20  	DefaultLayoutPath = "./layout"
    21  	// DefaultThumbnailCachePath is the default thumbnail cache path.
    22  	DefaultThumbnailCachePath = "./thumbnails"
    23  	// DefaultPagesPath is the default partials path.
    24  	DefaultPagesPath = "./layout/pages"
    25  	// DefaultPartialsPath is the default partials path.
    26  	DefaultPartialsPath = "./layout/partials"
    27  	// DefaultImagePostTemplatePath is the default image post template path.
    28  	DefaultImagePostTemplatePath = "./layout/image.html"
    29  	// DefaultTextPostTemplatePath is the default text post template path.
    30  	DefaultTextPostTemplatePath = "./layout/text.html"
    31  	// DefaultTagTemplatePath is the default tag template path.
    32  	DefaultTagTemplatePath = "./layout/tag.html"
    33  )
    34  
    35  // DefaultSlugTemplate is the default slug format.
    36  const (
    37  	DefaultSlugTemplate = `{{ .Meta.Posted | time_format "2006/01/02" }}/{{ .Meta.Title | slugify }}`
    38  )
    39  
    40  // OutputFiles are known output file names.
    41  const (
    42  	FileIndex         = "index.html"
    43  	FileMeta          = "meta.yml"
    44  	FileData          = "data.json"
    45  	FileImageOriginal = "original.jpg"
    46  )
    47  
    48  // Sizes are the default sizes for the resized images.
    49  const (
    50  	SizeLarge  = 2048
    51  	SizeMedium = 1024
    52  	SizeSmall  = 512
    53  )
    54  
    55  // DefaultImageSizes are the default resize dimensions.
    56  // The size given will be the largest dimension of the final image.
    57  // If the image is landscape, it will be the width.
    58  // If the image is portrait, it will be the height.
    59  var (
    60  	DefaultImageSizes = []int{
    61  		SizeLarge,
    62  		SizeMedium,
    63  		SizeSmall,
    64  	}
    65  )
    66  
    67  // ImageSizeFormat is the format for the thumbnail images..
    68  const (
    69  	ImageSizeFormat = "%d.jpg"
    70  )
    71  
    72  // Extensions are file suffixes that indicate file type.
    73  const (
    74  	ExtensionJPG  = ".jpg"
    75  	ExtensionJPEG = ".jpeg"
    76  	ExtensionHTML = ".html"
    77  )
    78  
    79  // Known Extensions
    80  var (
    81  	ImageExtensions = []string{
    82  		ExtensionJPG,
    83  		ExtensionJPEG,
    84  	}
    85  	TemplateExtensions = []string{
    86  		ExtensionHTML,
    87  	}
    88  )
    89  
    90  // PostSortKeys
    91  var (
    92  	PostSortKeyCapture = "capture"
    93  	PostSortKeyPosted  = "posted"
    94  	PostSortKeyIndex   = "index"
    95  	PostSortKeyTitle   = "title"
    96  )