Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to YAML #62

Closed
CaiJimmy opened this issue Dec 11, 2020 · 0 comments · Fixed by #65
Closed

Migrate to YAML #62

CaiJimmy opened this issue Dec 11, 2020 · 0 comments · Fixed by #65
Labels
refactor Refactoring code

Comments

@CaiJimmy
Copy link
Owner

CaiJimmy commented Dec 11, 2020

Something I've planning to do is replace config.toml with config.yaml. I think it's clearer and easier to write.

Using TOML (current)

baseurl = "https://example.com"
languageCode = "en-us"
theme = "hugo-theme-stack"
paginate = 5
title = "Example Site"
disqusShortname = "hugo-theme-stack"            # Change it to your Disqus shortname before using
DefaultContentLanguage = "en"                   # Theme i18n support

[permalinks]
    post = "/p/:slug/"
    page = "/:slug/"
    
[params]
    mainSections = ["post"]
    featuredImageField = "image"
    rssFullContent = true
    
    [params.dateFormat]
        published = "Jan 02, 2006"
        lastUpdated = "Jan 02, 2006 15:04 MST"
        
    [params.sidebar]
        emoji = "🍥"
        avatar = "img/avatar.png"
        subtitle = "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
        
    [params.article]
        math = false
        [params.article.license]
            enabled = true 
            default = "Licensed under CC BY-NC-SA 4.0"
            
    [params.comments]
        enabled = true
        provider = "disqus"         # Available: disqus, utterances    
        [params.comments.utterances]
            repo = ""
            issueTerm = "pathname"
            label = ""             # Optional
            theme = "preferred-color-scheme"
            
    [params.widgets]
        enabled = ['search', 'archives', 'tag-cloud']
        [params.widgets.archives]
            limit = 5
            ### Archives page relative URL
            path = "archives"       
        [params.widgets.tagCloud]
            limit = 10
            
    [params.opengraph]
        [params.opengraph.twitter]
            site = ""
            card = "summary_large_image"
            
    [params.defaultImage]
        [params.defaultImage.opengraph]
            enabled = false
            local = false
            src = ""
            
[menu]
    [[menu.main]]
        identifier = "home"
        name = "Home"
        url = "/"
        weight = -100
        pre = "home"
    [[menu.main]]
        identifier = "about-cn"
        name = "About"
        url = "about"
        weight = -90
        pre = "user"
    [[menu.main]]
        identifier = "archives"
        name = "Archives"
        url = "archives"
        weight = -70
        pre = "archives"
    [[menu.main]]
        identifier = "search"
        name = "Search"
        url = "search"
        weight = -60
        pre = "search"

[related]
    includeNewer = true
    threshold = 60
    toLower = false

    [[related.indices]]
        name = "tags"
        weight = 100

    [[related.indices]]
        name = "categories"
        weight = 200

[markup]
    [markup.highlight]
        noClasses = false

Using YAML

baseurl: 'https://example.com'
languageCode: en-us
theme: hugo-theme-stack
paginate: 5
title: Example Site
disqusShortname: hugo-theme-stack
DefaultContentLanguage: en
permalinks:
    post: '/p/:slug/'
    page: '/:slug/'
params:
    mainSections:
        - post
    featuredImageField: image
    rssFullContent: true
    dateFormat:
        published: 'Jan 02, 2006'
        lastUpdated: 'Jan 02, 2006 15:04 MST'
    sidebar:
        emoji: "🍥"
        avatar: img/avatar.png
        subtitle: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'
    article:
        math: false
        license:
            enabled: true
            default: Licensed under CC BY-NC-SA 4.0
    comments:
        enabled: true
        provider: disqus
        utterances:
            repo: ''
            issueTerm: pathname
            label: ''
            theme: preferred-color-scheme
    widgets:
        enabled:
            - search
            - archives
            - tag-cloud
        archives:
            limit: 5
            path: archives
        tagCloud:
            limit: 10
    opengraph:
        twitter:
            site: ''
            card: summary_large_image
    defaultImage:
        opengraph:
            enabled: false
            local: false
            src: ''
menu:
    main:
        -
            identifier: home
            name: Home
            url: /
            weight: -100
            pre: home
        -
            identifier: about-cn
            name: About
            url: about
            weight: -90
            pre: user
        -
            identifier: archives
            name: Archives
            url: archives
            weight: -70
            pre: archives
        -
            identifier: search
            name: Search
            url: search
            weight: -60
            pre: search
related:
    includeNewer: true
    threshold: 60
    toLower: false
    indices:
        -
            name: tags
            weight: 100
        -
            name: categories
            weight: 200
markup:
    highlight:
        noClasses: false

The old config.toml will continue to work.


It's not decided yet. Opinions are welcome :)

@CaiJimmy CaiJimmy added the refactor Refactoring code label Dec 11, 2020
CaiJimmy pushed a commit that referenced this issue Dec 11, 2020
CaiJimmy pushed a commit that referenced this issue Dec 15, 2020
* refactor(config): use YAML instead of TOML

closes #62

* refactor(config.yaml): clear up

* style(config): formatting & add i18n comment
rinav pushed a commit to rinav/hugo-theme-stack that referenced this issue Dec 24, 2020
* refactor(config): use YAML instead of TOML

closes CaiJimmy#62

* refactor(config.yaml): clear up

* style(config): formatting & add i18n comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactoring code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant