Some SEO and accessibility fixes

This commit is contained in:
Barunes Padhy 2024-06-22 08:56:31 +03:00
parent 8b01cd3a0a
commit c160515b46
5 changed files with 39 additions and 21 deletions

View File

@ -63,6 +63,10 @@ updates = run_git_command('git_diff', rangolio_location, ['origin/main'])
if updates['subprocess_output'] and updates['subprocess_returncode'] == 0:
update_confirmation = draw_dialogue_box('Software Update', 'Would you like to update rangolio?', 'confirmation')
if update_confirmation:
update_rangolio(rangolio_location)
try:
update_rangolio(rangolio_location)
draw_dialogue_box('Update', 'The Update was successful', 'confirmation')
except:
draw_dialogue_box('Update', 'The Update was unsuccessful', 'confirmation')
else:
print('No updates')

View File

@ -73,12 +73,9 @@ def git_check_user_details(deploy_location):
def git_update_viewable_ui(deploy_location, dist_folder_name, copy_index_and_asset=True):
# deploy_location = server.old ; dist_folder_name = server
# server.old -> server.old.temp
shutil.move(deploy_location, f'{deploy_location}.temp')
# server -> server.old
shutil.move(f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/{dist_folder_name}', f'{deploy_location}')
if copy_index_and_asset:

View File

@ -60,7 +60,7 @@ class Publish(APIView):
print(f"The directory {data_directory} does not exist.")
def create_json_and_html(self, json_storage, html_storage, deploy_type):
self.create_user_data_json(UserData.objects.first(), json_storage)
self.create_user_data_json_and_html(UserData.objects.first(), json_storage, html_storage, deploy_type)
self.create_theme_data_json(UserData.objects.first(), json_storage)
self.create_category_data_json_and_html(Category, json_storage, html_storage, deploy_type)
self.create_blog_data_json_and_html(Blog.objects.all(), json_storage, html_storage, deploy_type, UserData.objects.first())
@ -70,7 +70,7 @@ class Publish(APIView):
'folder',
)
def create_user_data_json(self, instance, json_storage):
def create_user_data_json_and_html(self, instance, json_storage, html_storage, deploy_type):
json_content = {
"name": instance.name,
"introContent": self.sanitize_media_link(instance.intro_content, 'content_media'),
@ -79,6 +79,22 @@ class Publish(APIView):
}
self.save_json(json_content, 'shared/user-data.json', json_storage)
html_file = open(f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/{deploy_type}/index.html', "r")
html_file_content = html_file.read()
html_soup = BeautifulSoup(html_file_content, 'lxml')
html_soup.title.string = json_content['name']
meta_description = html_soup.new_tag('meta', attrs={'name': 'description', 'content': f'{json_content['name']}. Learn more about {json_content['name']}'})
meta_robots = html_soup.new_tag('meta', attrs={'name': 'robots', 'content': 'index, follow'})
html_soup.head.append(meta_description)
html_soup.head.append(meta_robots)
html_storage.save(f'index.html', ContentFile(str(html_soup).encode('utf-8')))
copy_content(f'{settings.DEPLOY_CONFIG["EDITOR_HTML_LOCATION"]}/index.html',
f'{settings.DEPLOY_CONFIG["DEPLOY_LOCATION"]}/{deploy_type}/index.html',
'file',
'remove_and_copy'
)
def create_theme_data_json(self, instance, json_storage):
json_content = {
"defaultTheme": instance.default_theme,

View File

@ -37,7 +37,7 @@ function HomePage(props) {
<Row className='mb-4'>
<Col xs='3' className='d-none d-md-block'></Col>
<Col className='p-0'>
{UserData.profilePhoto !== '' ? <img style={{ width: '180px', height: '180px', objectFit: 'cover' }} className='mx-auto d-block rounded-circle' src={MediaService.getMedia(UserData.profilePhoto)} /> : ''}
{UserData.profilePhoto !== '' ? <img style={{ width: '180px', height: '180px', objectFit: 'cover' }} alt={UserData.name} className='mx-auto d-block rounded-circle' src={MediaService.getMedia(UserData.profilePhoto)} /> : ''}
</Col>
<Col xs='3' className='d-none d-md-block'></Col>
</Row>

View File

@ -36,19 +36,20 @@ function Header(props) {
expand='lg'>
<Container>
<NavbarBrand>
<Link to='/'>
{
UserData.profilePhoto !== '' ?
<img
style={{ width: '40px', height: '40px', objectFit: 'cover', 'marginRight': '10px' }}
className='rounded-circle'
src={MediaService.getMedia(UserData.profilePhoto)}
/> : ''
}
<Button color={`${ThemeConfig ? ThemeConfig[GlobalTheme].navBar['buttonColor'] : ''}`} size='lg'>
{
UserData.profilePhoto !== '' ?
<img
style={{ width: '40px', height: '40px', objectFit: 'cover', 'marginRight': '10px' }}
className='rounded-circle'
alt={UserData.name}
src={MediaService.getMedia(UserData.profilePhoto)}
/> : ''
}
<Button color={`${ThemeConfig ? ThemeConfig[GlobalTheme].navBar['buttonColor'] : ''}`} size='lg'>
<Link to='/'>
{ UserData ? UserData.name : <Spinner> Loading... </Spinner> }
</Button>
</Link>
</Link>
</Button>
</NavbarBrand>
<Nav className='ml-lg-auto' navbar>
<NavItem>