@content_git_object_init.connect
def git_permalink(content, git_content):
 if (not content.settings['GIT_GENERATE_PERMALINK']):
  return
 if (not string_to_bool(content.metadata.get('git_permalink', 'yes'))):
  return
 if (not git_content.is_committed()):
  return
 permalink_hash = hashlib.sha1()
 permalink_hash.update(str(git_content.get_oldest_commit()))
 permalink_hash.update(str(git_content.get_oldest_filename()))
 git_permalink_id = base64.urlsafe_b64encode(permalink_hash.digest())
 permalink_id_metadata_key = content.settings['PERMALINK_ID_METADATA_KEY']
 if (permalink_id_metadata_key in content.metadata):
  content.metadata[permalink_id_metadata_key] = ','.join((content.metadata[permalink_id_metadata_key], git_permalink_id))
 else:
  content.metadata[permalink_id_metadata_key] = git_permalink_id

@ content_git_object_init . connect def git_permalink ( content , git_content ) : if ( not content . settings [ 'GIT_GENERATE_PERMALINK' ] ) : return if ( not string_to_bool ( content . metadata . get ( 'git_permalink' , 'yes' ) ) ) : return if ( not git_content . is_committed ( ) ) : return permalink_hash = hashlib . sha1 ( ) permalink_hash . update ( str ( git_content . get_oldest_commit ( ) ) ) permalink_hash . update ( str ( git_content . get_oldest_filename ( ) ) ) git_permalink_id = base64 . urlsafe_b64encode ( permalink_hash . digest ( ) ) permalink_id_metadata_key = content . settings [ 'PERMALINK_ID_METADATA_KEY' ] if ( permalink_id_metadata_key in content . metadata ) : content . metadata [ permalink_id_metadata_key ] = ',' . join ( ( content . metadata [ permalink_id_metadata_key ] , git_permalink_id ) ) else : content . metadata [ permalink_id_metadata_key ] = git_permalink_id
add git based permalink id to content metadata .