Skip to content

Commit 22784f5

Browse files
authored
Merge pull request #1195 from curbengh/ignore-config
2 parents b492f17 + 913ae1b commit 22784f5

7 files changed

Lines changed: 362 additions & 30 deletions

File tree

source/docs/configuration.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Setting | Description | Default
111111
--- | --- | ---
112112
`date_format` | Date format | `YYYY-MM-DD`
113113
`time_format` | Time format | `HH:mm:ss`
114-
`use_date_for_updated` | Use the date of the post in [`post.updated`](/docs/variables#Page-Variables) if no updated date is provided in the front-matter. Typically used with Git workflow | `true`
114+
`use_date_for_updated` | Use the date of the post in [`post.updated`](/docs/variables#Page-Variables) if no updated date is provided in the front-matter. Typically used with Git workflow | `true`
115115

116116
### Pagination
117117

@@ -141,12 +141,15 @@ Setting | Description
141141

142142
### Include/Exclude Files or Folders
143143

144-
In the config file, set the include/exclude key to make hexo explicitly process or ignore certain files/folders. You can use [glob expressions](https://github.com/micromatch/micromatch#extended-globbing) for path matching.
144+
Use the following options to explicitly process or ignore certain files/folders. Support [glob expressions](https://github.com/micromatch/micromatch#extended-globbing) for path matching.
145+
146+
`include` and `exclude` options only apply to the `source/` folder, whereas `ignore` option applies to all folders.
145147

146148
Setting | Description
147149
--- | ---
148-
`include` | Hexo by default ignores hidden files and folders (including files and folders with a name that start with an underscore, with an exception*), but setting this field will make Hexo process them.
149-
`exclude` | Hexo process will ignore files list under this field.
150+
`include` | Include hidden files (including files/folders with a name that start with an underscore, with an exception*)
151+
`exclude` | Exclude files/folders
152+
`ignore` | Ignore files/folders
150153

151154
Examples:
152155
```yaml
@@ -174,13 +177,21 @@ exclude:
174177
# Do not use this to exclude posts in the 'source/_posts/'.
175178
# Use skip_render for that. Or prepend an underscore to the filename.
176179
# - "_posts/hello-world.md" # Does not work.
180+
181+
ignore:
182+
# Ignore any folder named 'foo'.
183+
- "**/foo"
184+
# Ignore 'foo' folder in 'themes/' only.
185+
- "**/themes/*/foo"
186+
# Same as above, but applies to every subfolders of 'themes/'.
187+
- "**/themes/**/foo"
177188
```
178189
179190
Each value in the list must be enclosed with single/double quotes.
180191
181-
`include:` and `exclude:` do not apply to the `themes/` folder. Prepend an underscore to the files or folders name in that folder to exclude them.
192+
`include:` and `exclude:` do not apply to the `themes/` folder. Either use `ignore:` or alternatively, prepend an underscore to the file/folder name to exclude.
182193

183-
* Notable exception is the `source/_posts` folder, but any file or folder with a name that starts with an underscore under that folder would still be ignored. Using `include:` rule in that folder is not recommended.
194+
\* Notable exception is the `source/_posts` folder, but any file or folder with a name that starts with an underscore under that folder would still be ignored. Using `include:` rule in that folder is not recommended.
184195

185196
### Using an Alternate Config
186197

source/ko/docs/configuration.md

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Hexo는 날짜 처리 시 [Moment.js](http://momentjs.com/)를 사용합니다.
7878
--- | --- | ---
7979
`date_format` | 날짜 형식 | `YYYY-MM-DD`
8080
`time_format` | 시간 형식 | `HH:mm:ss`
81-
`use_date_for_updated` | Use the date of the post in [`post.updated`](/ko/docs/variables#페이지 변수) if no updated date is provided in the front-matter. Typically used with Git workflow | `true`
81+
`use_date_for_updated` | Use the date of the post in [`post.updated`](/ko/docs/variables#페이지 변수) if no updated date is provided in the front-matter. Typically used with Git workflow | `true`
8282

8383
### Pagination
8484

@@ -93,3 +93,104 @@ Hexo는 날짜 처리 시 [Moment.js](http://momentjs.com/)를 사용합니다.
9393
--- | ---
9494
`theme` | 테마명. `false`라면 테마를 끕니다.
9595
`deploy` | Deployment 설정
96+
`meta_generator` | [Meta generator](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#Attributes) tag. `false` disables injection of the tag.
97+
98+
99+
### Include/Exclude Files or Folders
100+
101+
Use the following options to explicitly process or ignore certain files/folders. Support [glob expressions](https://github.com/micromatch/micromatch#extended-globbing) for path matching.
102+
103+
`include` and `exclude` options only apply to the `source/` folder, whereas `ignore` option applies to all folders.
104+
105+
Setting | Description
106+
--- | ---
107+
`include` | Include hidden files (including files/folders with a name that start with an underscore, with an exception*)
108+
`exclude` | Exclude files/folders
109+
`ignore` | Ignore files/folders
110+
111+
Examples:
112+
```yaml
113+
# Include/Exclude Files/Folders
114+
include:
115+
- ".nojekyll"
116+
# Include 'source/css/_typing.css'.
117+
- "css/_typing.css"
118+
# Include any file in 'source/_css/'.
119+
- "_css/*"
120+
# Include any file and subfolder in 'source/_css/'.
121+
- "_css/**/*"
122+
123+
exclude:
124+
# Exclude 'source/js/test.js'.
125+
- "js/test.js"
126+
# Exclude any file in 'source/js/'.
127+
- "js/*"
128+
# Exclude any file and subfolder in 'source/js/'.
129+
- "js/**/*"
130+
# Exclude any file with filename that starts with 'test' in 'source/js/'.
131+
- "js/test*"
132+
# Exclude any file with filename that starts with 'test' in 'source/js/' and its subfolders.
133+
- "js/**/test*"
134+
# Do not use this to exclude posts in the 'source/_posts/'.
135+
# Use skip_render for that. Or prepend an underscore to the filename.
136+
# - "_posts/hello-world.md" # Does not work.
137+
138+
ignore:
139+
# Ignore any folder named 'foo'.
140+
- "**/foo"
141+
# Ignore 'foo' folder in 'themes/' only.
142+
- "**/themes/*/foo"
143+
# Same as above, but applies to every subfolders of 'themes/'.
144+
- "**/themes/**/foo"
145+
```
146+
147+
Each value in the list must be enclosed with single/double quotes.
148+
149+
`include:` and `exclude:` do not apply to the `themes/` folder. Either use `ignore:` or alternatively, prepend an underscore to the file/folder name to exclude.
150+
151+
\* Notable exception is the `source/_posts` folder, but any file or folder with a name that starts with an underscore under that folder would still be ignored. Using `include:` rule in that folder is not recommended.
152+
153+
### Using an Alternate Config
154+
155+
A custom config file path can be specified by adding the `--config` flag to your `hexo` commands with a path to an alternate YAML or JSON config file, or a comma-separated list (no spaces) of multiple YAML or JSON files.
156+
157+
``` bash
158+
# use 'custom.yml' in place of '_config.yml'
159+
$ hexo server --config custom.yml
160+
161+
# use 'custom.yml' & 'custom2.json', prioritizing 'custom2.json'
162+
$ hexo server --config custom.yml,custom2.json
163+
```
164+
165+
Using multiple files combines all the config files and saves the merged settings to `_multiconfig.yml`. The later values take precedence. It works with any number of JSON and YAML files with arbitrarily deep objects. Note that **no spaces are allowed in the list**.
166+
167+
For instance, in the above example if `foo: bar` is in `custom.yml`, but `"foo": "dinosaur"` is in `custom2.json`, `_multiconfig.yml` will contain `foo: dinosaur`.
168+
169+
### Overriding Theme Config
170+
171+
Hexo themes are independent projects, with separate `_config.yml` files.
172+
173+
Instead of forking a theme, and maintaining a custom branch with your settings, you can configure it from your site's primary configuration file.
174+
175+
Example configuration:
176+
177+
```yml
178+
# _config.yml
179+
theme_config:
180+
bio: "My awesome bio"
181+
```
182+
183+
```yml
184+
# themes/my-theme/_config.yml
185+
bio: "Some generic bio"
186+
logo: "a-cool-image.png"
187+
```
188+
189+
Resulting in theme configuration:
190+
191+
```json
192+
{
193+
bio: "My awesome bio",
194+
logo: "a-cool-image.png"
195+
}
196+
```

source/pt-br/docs/configuration.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Configuração | Descrição | Padrão
7979
--- | --- | ---
8080
`date_format` | Formato de data | `YYYY-MM-DD`
8181
`time_format` | Formado de hora | `HH:mm:ss`
82-
`use_date_for_updated` | Use the date of the post in [`post.updated`](/pt-br/docs/variables#Variaveis-da-Pagina) if no updated date is provided in the front-matter. Typically used with Git workflow | `true`
82+
`use_date_for_updated` | Use the date of the post in [`post.updated`](/pt-br/docs/variables#Variaveis-da-Pagina) if no updated date is provided in the front-matter. Typically used with Git workflow | `true`
8383

8484
### Paginação
8585

@@ -95,25 +95,63 @@ Configuração | Descrição
9595
`theme` | Nome do tema. `false` desabilita o tema
9696
`theme_config` | Configuração do tema. Inclui quaisquer configurações de tema personalizado sob esta chave para substituir os padrões do tema.
9797
`deploy` | Configurações de implantação
98+
`meta_generator` | [Meta generator](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#Attributes) tag. `false` disables injection of the tag.
9899

99100
### Incluir/Excluir Arquivos ou Diretórios
100101

101102
No arquivo de configuração, defina a chave de include/exclude para que o hexo processe ou ignore, explicitamente, determinados arquivos/diretórios.
102103

104+
`include` and `exclude` options only apply to the `source/` folder, whereas `ignore` option applies to all folders.
105+
103106
Configuração | Descrição
104107
--- | ---
105108
`include` | Por padrão, o Hexo ignora os arquivos e diretórios ocultos, mas configurar este campo fará com que o Hexo os processe também
106109
`exclude` | O Hexo irá ignorar os arquivos e diretórios listados abaixo deste campo
110+
`ignore` | Ignore files/folders
107111

108112
Exemplo:
109113
```yaml
110114
# Incluir/Excluir Arquivos/Diretórios
111115
include:
112-
- .nojekyll
116+
- ".nojekyll"
117+
# Include 'source/css/_typing.css'.
118+
- "css/_typing.css"
119+
# Include any file in 'source/_css/'.
120+
- "_css/*"
121+
# Include any file and subfolder in 'source/_css/'.
122+
- "_css/**/*"
123+
113124
exclude:
114-
- .DS_Store
125+
# Exclude 'source/js/test.js'.
126+
- "js/test.js"
127+
# Exclude any file in 'source/js/'.
128+
- "js/*"
129+
# Exclude any file and subfolder in 'source/js/'.
130+
- "js/**/*"
131+
# Exclude any file with filename that starts with 'test' in 'source/js/'.
132+
- "js/test*"
133+
# Exclude any file with filename that starts with 'test' in 'source/js/' and its subfolders.
134+
- "js/**/test*"
135+
# Do not use this to exclude posts in the 'source/_posts/'.
136+
# Use skip_render for that. Or prepend an underscore to the filename.
137+
# - "_posts/hello-world.md" # Does not work.
138+
139+
ignore:
140+
# Ignore any folder named 'foo'.
141+
- "**/foo"
142+
# Ignore 'foo' folder in 'themes/' only.
143+
- "**/themes/*/foo"
144+
# Same as above, but applies to every subfolders of 'themes/'.
145+
- "**/themes/**/foo"
115146
```
116147
148+
Each value in the list must be enclosed with single/double quotes.
149+
150+
`include:` and `exclude:` do not apply to the `themes/` folder. Either use `ignore:` or alternatively, prepend an underscore to the file/folder name to exclude.
151+
152+
\* Notable exception is the `source/_posts` folder, but any file or folder with a name that starts with an underscore under that folder would still be ignored. Using `include:` rule in that folder is not recommended.
153+
154+
117155
### Usando uma Configuração Alternativa
118156

119157
Um arquivo de configuração personalizado pode ser especificado adicionando o sinalizador `--config` aos comandos do `hexo` com o caminho para o arquivo alternativo de configuração YAML ou JSON, ou até mesmo uma lista separada por vírgulas (sem espaços) de múltiplos arquivos YAML ou JSON.

source/ru/docs/configuration.md

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Hexo использует [Moment.js](http://momentjs.com/) для работы
7878
--- | --- | ---
7979
`date_format` | Формат даты | `YYYY-MM-DD`
8080
`time_format` | Формат времени | `HH:mm:ss`
81-
`use_date_for_updated` | Use the date of the post in [`post.updated`](/ru/docs/variables#Переменные-страницы) if no updated date is provided in the front-matter. Typically used with Git workflow | `true`
81+
`use_date_for_updated` | Use the date of the post in [`post.updated`](/ru/docs/variables#Переменные-страницы) if no updated date is provided in the front-matter. Typically used with Git workflow | `true`
8282

8383
### Разбивка на страницы
8484

@@ -93,3 +93,103 @@ Hexo использует [Moment.js](http://momentjs.com/) для работы
9393
--- | ---
9494
`theme` | Имя темы. `false` отключает применение тем
9595
`deploy` | Параметры публикации
96+
`meta_generator` | [Meta generator](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta#Attributes) tag. `false` disables injection of the tag.
97+
98+
### Incluir/Excluir Arquivos ou Diretórios
99+
100+
No arquivo de configuração, defina a chave de include/exclude para que o hexo processe ou ignore, explicitamente, determinados arquivos/diretórios.
101+
102+
`include` and `exclude` options only apply to the `source/` folder, whereas `ignore` option applies to all folders.
103+
104+
Configuração | Descrição
105+
--- | ---
106+
`include` | Por padrão, o Hexo ignora os arquivos e diretórios ocultos, mas configurar este campo fará com que o Hexo os processe também
107+
`exclude` | O Hexo irá ignorar os arquivos e diretórios listados abaixo deste campo
108+
`ignore` | Ignore files/folders
109+
110+
Exemplo:
111+
```yaml
112+
# Incluir/Excluir Arquivos/Diretórios
113+
include:
114+
- ".nojekyll"
115+
# Include 'source/css/_typing.css'.
116+
- "css/_typing.css"
117+
# Include any file in 'source/_css/'.
118+
- "_css/*"
119+
# Include any file and subfolder in 'source/_css/'.
120+
- "_css/**/*"
121+
122+
exclude:
123+
# Exclude 'source/js/test.js'.
124+
- "js/test.js"
125+
# Exclude any file in 'source/js/'.
126+
- "js/*"
127+
# Exclude any file and subfolder in 'source/js/'.
128+
- "js/**/*"
129+
# Exclude any file with filename that starts with 'test' in 'source/js/'.
130+
- "js/test*"
131+
# Exclude any file with filename that starts with 'test' in 'source/js/' and its subfolders.
132+
- "js/**/test*"
133+
# Do not use this to exclude posts in the 'source/_posts/'.
134+
# Use skip_render for that. Or prepend an underscore to the filename.
135+
# - "_posts/hello-world.md" # Does not work.
136+
137+
ignore:
138+
# Ignore any folder named 'foo'.
139+
- "**/foo"
140+
# Ignore 'foo' folder in 'themes/' only.
141+
- "**/themes/*/foo"
142+
# Same as above, but applies to every subfolders of 'themes/'.
143+
- "**/themes/**/foo"
144+
```
145+
146+
Each value in the list must be enclosed with single/double quotes.
147+
148+
`include:` and `exclude:` do not apply to the `themes/` folder. Either use `ignore:` or alternatively, prepend an underscore to the file/folder name to exclude.
149+
150+
\* Notable exception is the `source/_posts` folder, but any file or folder with a name that starts with an underscore under that folder would still be ignored. Using `include:` rule in that folder is not recommended.
151+
152+
### Usando uma Configuração Alternativa
153+
154+
Um arquivo de configuração personalizado pode ser especificado adicionando o sinalizador `--config` aos comandos do `hexo` com o caminho para o arquivo alternativo de configuração YAML ou JSON, ou até mesmo uma lista separada por vírgulas (sem espaços) de múltiplos arquivos YAML ou JSON.
155+
156+
``` bash
157+
# usando 'custom.yml' no lugar de '_config.yml'
158+
$ hexo server --config custom.yml
159+
160+
# usando 'custom.yml' e 'custom2.json', priorizando 'custom2.json'
161+
$ hexo server --config custom.yml,custom2.json
162+
```
163+
164+
O uso de vários arquivos combina todos os arquivos de configuração e salva as configurações mescladas para `_multiconfig.yml`. Os valores posteriores prevalecem. Este recurso funciona com qualquer quantidade de arquivos JSON e YAML com objetos arbitrariamente profundos. Observe que **nenhum espaço é permitido na lista**.
165+
166+
Por exemplo, no exemplo acima se `foo: bar` estiver em `custom.yml`, mas `"foo": "dinosaur"` estiver em `custom2.json`, `_multiconfig.yml` irá conter `foo: dinosaur`.
167+
168+
### Sobrescrevendo as Configurações do Tema
169+
170+
Os temas do Hexo são projetos independentes, com arquivos `_config.yml` separados.
171+
172+
Em vez de dar fork em um tema e manter uma branch personalizada com suas configurações, você pode configurá-lo a partir do arquivo de configuração principal do seu site.
173+
174+
Exemplo de configuração:
175+
176+
```yml
177+
# _config.yml
178+
theme_config:
179+
bio: "My awesome bio"
180+
```
181+
182+
```yml
183+
# themes/my-theme/_config.yml
184+
bio: "Some generic bio"
185+
logo: "a-cool-image.png"
186+
```
187+
188+
Resultado da configuração do tema:
189+
190+
```json
191+
{
192+
bio: "My awesome bio",
193+
logo: "a-cool-image.png"
194+
}
195+
```

0 commit comments

Comments
 (0)