Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MDwikiをIISにホストするスクリプト
# 基本的には
# http://dynalon.github.io/mdwiki/#!tutorials/iis/iis.md
# の手順を参照のこと
#
# サイト設定(Default Web Site)
$SITE_ROOT = 'C:\inetpub\wwwroot'
$SITE_PATH = 'MACHINE/WEBROOT/APPHOST/Default Web Site'
# IISのインストール
Install-WindowsFeature Web-WebServer, Web-Mgmt-Console
# MIME設定の変更
$mime = Get-WebConfiguration -PSPath $SITE_PATH -Filter system.webServer/staticContent/mimeMap | Where-Object { $_.fileExtension -eq '.md' }
if($null -eq $mime) {
Add-WebConfiguration -PSPath $SITE_PATH -Filter system.webServer/staticContent -Value @{fileExtension='.md'; mimeType='text/x-markdown'}
}
# mdwiki.htmlの追加
# なぜかVer.0.6.2だとデバッグ版でしか動かない
#Invoke-WebRequest -Uri http://dynalon.github.io/mdwiki/mdwiki-latest.html -OutFile (Join-Path $SITE_ROOT 'index.html')
Invoke-WebRequest -Uri http://dynalon.github.io/mdwiki/mdwiki-latest-debug.html -OutFile (Join-Path $SITE_ROOT 'index.html')
# その他最低限の初期ファイルを追加
@"
My MDwiki Website
----------------
### Hello World!
"@ | Set-Content -LiteralPath (Join-Path $SITE_ROOT 'index.md') -Encoding UTF8
@"
# My MDwiki
[gimmick:theme](flatly)
[Top](index.md)
[gimmick:themechooser](Choose theme)
"@ | Set-Content -LiteralPath (Join-Path $SITE_ROOT 'navigation.md') -Encoding UTF8
@"
{
"title": "My MDwiki"
}
"@ | Set-Content -LiteralPath (Join-Path $SITE_ROOT 'config.json') -Encoding UTF8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment