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

added Add_cname plugin #566

Open
wants to merge 3 commits into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -38,6 +38,8 @@ Plugin Description
======================== ===========================================================
Always modified Copy created date metadata into modified date for easy "latest updates" indexes

Add CNAME Simply adds CNAME file with domain in your output directory

AsciiDoc reader Use AsciiDoc to write your posts.

Asset management Use the Webassets module to manage assets such as CSS and JS files.
@@ -0,0 +1 @@
from .add_cname import *
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
"""
Add_cname
--------
Add CNAME file in your output directory.
"""

import os
from pelican import signals

def add_cname(p):
"""
:param p: pelican instance
:return: None
"""

cname_path = os.path.join(p.output_path, 'CNAME')
siteurl = p.settings.get('SITEURL', "127.0.0.1:8000")
siteurl = siteurl.replace("http://", "")
with open(cname_path, 'w') as cname_file:
cname_file.write(siteurl)

def register():
signals.finalized.connect(add_cname)
@@ -0,0 +1,6 @@
Add CNAME Plugin
===================
* Author: Dmitriy Kalinin <dem.mort@gmail.com*

Simplest plugin that adds CNAME file with your production domain to your output directory.
It may be useful if your site hosted on GitHub pages with custom domain.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.